PROJECT DUE 01-20-08 (accessing drives using Java)

ei guys, i really need immediate help. i got this project due January 20, 2008. What package from JDK 1.6 can i use to access local hard drives? or rather can anyone teach me how to access a hard drive using java?

Here's a detail description on my project:

I've created a JFrame that contains a JButton, and what i need
the button to perform when pressed is to automatically open a
specific drive via Windows explorer, lets say drive "D:". So
basically pressing the JButton is similar as running "My
Computer" then double clicking the hard disk drive "D:".

pls guys i really need your help as soon as possible!

THANX A LOT!=)

[OT] Runtime.exec()

I am sorry, but your question seems pretty off-topic for this site.
However, I will try to help, because I believe, "when asked, teach."

Please read up on the Runtime class, specifically the exec() method:
http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html

For example, you could (but shouldn't, see below) have your button handler call: Runtime.exec("explorer d:\");

Now be warned this is a HorribleThingToDo(tm) for several reasons:
1. The command is hardcoded as a String constant. Yuck.
2. Calling native OS executables means you have non-portable code. Double yuck.
3. You are doing this on Windows. Yuck^2 (just my opinion on this one).
4. If something like this ended up in production code that came past my desk, I would fire whoever wrote it.
5. You are a half-step from a massive security problem in code: asking users to enter commands to run when pressing buttons. If you let users pass command strings to Runtime.exec(), be sure they don't put "format c:\ /f" or anything else sneaky!
I am sure there are many more, but that should be more than enough reason to never do this.

Honestly, just don't use Runtime.exec() unless someone has a gun to your head.

Open a Java file dialog instead which is portable, or create a pane, grab the list of objects in a directory and draw them as icons or something, anything other that my extremely evil example above.

Learn more:
http://java.sun.com/docs/books/tutorial/index.html
--
Robert "Exile In Paradise" Murphey

Clarifications

thanks for the speedy reply guys. im sorry if i didnt really put this in to further details.. my project is actually a password protection software imlemented in java. this software would be for flashdrive devices. so i think a cant use Runtime().exec() coz as much as possible i need my software to run in multi platforms. so actually, after a user goes through the password protection system i created, i need my software to open the drive where my software is installed. i hope i made it clear enough. thanks for your support guys!

not the better place for that !

It's not the better place for that !

Moreover, running such things from java is not really in the java philosophy in my opinion but that can be done.

Here is a tip : you should do something like : Runtime.getRuntime().exec(...). There is multiple methods : look javadoc on sun's site

Fabien

my blog (in english and french)