Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

Detect Removable Drives

Thread view: 
Don Hamilton - 05 Jun 2006 01:44 GMT
Hi,

For a small Windows desktop application I needed a simple way to check
for the existence and drive names of cdrom drives. My immediate
inclination was to iterate through an array returned by list.Roots()
using File.exists() with empty drives as the test. But I seem to recall
that problems have  been reported where exists() would'nt,in the case of
Win XP or one of its SP's, work as I expected

An alternative would be to use a WIM/script function, but again as I
understand it, accomodating the various flavours of Windows is not
entirely without problems.

As a relative novice I'm fumbling my way through this, so any comments
would be welcome as to the most reliable route to persue. I'm not
looking for example code, just a prod in the right direction.

As an aside, from what I read the emergence of Java 7 (Dolphin) might
possibly (MS permitting) put an end to this type of problem.

Don Hamilton.
Chris Smith - 05 Jun 2006 02:41 GMT
> For a small Windows desktop application I needed a simple way to check
> for the existence and drive names of cdrom drives. My immediate
> inclination was to iterate through an array returned by list.Roots()
> using File.exists() with empty drives as the test. But I seem to recall
> that problems have  been reported where exists() would'nt,in the case of
> Win XP or one of its SP's, work as I expected

Indeed.  The only reliable way to do what you want is to use Windows-
specific APIs, which means writing code in some other language than
Java.  The interface between your non-Java code and the Windows
application would probably be JNI, although you could use something
else, such as standard I/O streams or a TCP socket, if you want to avoid
incorporating a C or C++ build environment into your project (assuming
you don't use C or C++ to write the API in the first place).

Signature

Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.