Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 25-11-2009
Member
 
Join Date: Nov 2009
Posts: 57
Finding all the drives through Java

I want to know is there any way to list all local drives using java program. I want to create a software and in that I want a list of all local drivers so that I can click on it and select it. Please send me code that find all local drives.
Reply With Quote
  #2  
Old 25-11-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: Finding all the drives through Java

I think this code give you list of all drives-

Code:
      File []drives = new File("").listRoots();
   
      for(int m=0;j<drives.length;m++)
  
      System.out.println(drives[m]);
Reply With Quote
  #3  
Old 25-11-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Finding all the drives through Java

Code:
      for(File drive : File.listRoots() )

      System.out.println(drive);
This is a most easiest code to find all drives.
Reply With Quote
  #4  
Old 25-11-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Finding all the drives through Java

Code:
    File[] roots = File.listRoots();
    for(int p=0;p<roots.length;p++)
    System.out.println("Root["+p+"]:" + roots[p]);
    System.out.println(drives[p]);
It will help you.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Finding all the drives through Java"
Thread Thread Starter Forum Replies Last Post
Need help finding drivers for IBM Quinn28 Operating Systems 1 14-12-2011 05:51 PM
Eset NOD32 lock sata drives while using external drives Ecchumati Networking & Security 9 24-11-2011 02:13 PM
My Windows XP laptop has stopped recognising/working with my external hard-drives and USB flash-drives HowlCat Operating Systems 1 30-09-2011 12:00 PM
Need help finding a UPS for my current rig Danvir Hardware Peripherals 5 21-11-2010 02:28 AM
SYSTEM process (USBPORT.SYS) takes 50% CPU power + USB drives n mobiles not recognized + NADFOLDER & Autorun.inf issue with USB drives and PC's rahularoracream XP Hardware 3 16-10-2010 10:22 PM


All times are GMT +5.5. The time now is 03:43 PM.