list root with JDK
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, May 26, 2003 08:07 AM

// With the following code using JDK 1.4.01... I can get The  list root of a machine (C:/ , A:/ , D:/, ......) , but if  I use the first versions of JDK it is not possible.   File list[] = File.listRoots(); for ( int i = 0; i < list.length; i++ ) { File root = list[i]; if ( root.exists() ) System.out.println( root.getPath());     Can you help me to get a List Root of a Machine using the first versions of jdk too ? thanks    More>>

// With the following code using JDK 1.4.01... I can get The  list root
of a machine (C:/ , A:/ , D:/, ......) , but if  I use the first versions of
JDK it is not possible.


 


File list[] = File.listRoots();



for ( int i = 0; i < list.length; i++ )

{

File root = list[i];



if ( root.exists() )



System.out.println( root.getPath());

 


 


Can you help me to get a List Root of a Machine using the first versions of jdk
too ?


thanks    <<Less

Re: list root with JDK

Posted By:   Benoit_Quintin  
Posted On:   Monday, May 26, 2003 12:07 PM

Well, according to http://java.sun.com/j2se/1.4.1/docs/api/java/io/File.html, this method has been a part of the JDK since 1.2

The thing is that implementing it will be platform-dependent, unless you implement it exactly the way it's done in the JDK.

If I were you, I'd make sure that the code _has_ to work under JDK1.1-, odds are that most people upgrade their VMs every once in a while...
About | Sitemap | Contact