Ejecting USB

hi,

is there a way I can eject the USB diskdrive whereby when i press a button it will say "Safely remove hardware" like in the computer taskbar?

for this code below is detect the USB if it is insertFile f =new File("f:/");

while (!f.exists())

try{

Thread.sleep(500);

}

catch (InterruptedException e){

}

thank you

jp

[648 byte] By [juniorprogrammera] at [2007-11-27 8:56:55]
# 1
why dont u try Thread.Kill or Thread.Suspend
LoveOpensourcea at 2007-7-12 21:20:43 > top of Java-index,Java Essentials,Java Programming...
# 2

File f = new File("f:/");

while (!f.exists())

try {

Thread.sleep(500);

}

catch (InterruptedException e) {

}

while(f.exists())

try {

Thread.kill();

}

catch (InterruptedException e) {

}

thanks for the solution earlier but i can't compiled, it says cannot find symbol thread.kill()

by the way can i use this instead?while(f.exists())

try {

f.deleteOnExit();

}

catch (InterruptedException e) {

}

thanks

jp

juniorprogrammera at 2007-7-12 21:20:43 > top of Java-index,Java Essentials,Java Programming...
# 3
Yeah. But first you have to go through the Windows APIs.Here, this might help you, although it probably won't: http://msdn2.microsoft.com/en-us/library/aa363216.aspx>why dont u try>Thread.Kill or Thread.Suspend Was that supposed to be sarcastic?
myncknma at 2007-7-12 21:20:43 > top of Java-index,Java Essentials,Java Programming...
# 4
> >why dont u try> >Thread.Kill or Thread.Suspend > > Was that supposed to be sarcastic?Unfortunately, probably not.Never trust anyone with under 1000 posts.
-Kayaman-a at 2007-7-12 21:20:43 > top of Java-index,Java Essentials,Java Programming...
# 5
> Never trust anyone with under 1000 posts.Mm. Especially not when they apparently don't know correct spelling, grammar, or programming conventions.
myncknma at 2007-7-12 21:20:43 > top of Java-index,Java Essentials,Java Programming...