How to call system command to launch Windows Explorer

Hello,I'd like to open the windows explorer from java.... anyone know how this is done?thanks
[115 byte] By [llpindda] at [2007-10-3 4:20:33]
# 1

heres a code snippet that should do what you are after...

public class run

{

public static void main(String[] args) throws Exception

{

Process p = Runtime.getRuntime().exec("iexplore.exe");

p.waitFor();

System.out.println("Done.");

}

}

.neogeo.a at 2007-7-14 22:22:33 > top of Java-index,Desktop,Core GUI APIs...
# 2

thanks for ur reply.

i get the following exception when i run the code provided...

java.io.IOException: CreateProcess: iexplore.exe error=2

at java.lang.Win32Process.create(Native Method)

at java.lang.Win32Process.<init>(Win32Process.java:66)

at java.lang.Runtime.execInternal(Native Method)

at java.lang.Runtime.exec(Runtime.java:566)

at java.lang.Runtime.exec(Runtime.java:428)

at java.lang.Runtime.exec(Runtime.java:364)

at java.lang.Runtime.exec(Runtime.java:326)

at Run.main(Run.java:5)

Exception in thread "main"

also, i needed a way to open exploerer to a preset directory. do i just append the directory location before the iexplore.exe ?anyone?thanks

llpindda at 2007-7-14 22:22:33 > top of Java-index,Desktop,Core GUI APIs...
# 3
Process p = Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe");?
JLuisa at 2007-7-14 22:22:33 > top of Java-index,Desktop,Core GUI APIs...
# 4
Do u wanna to open Internet Explorer or Windows explorer,If windows explorer means use explorer.exe instead of iexplore.exe(Internet explorer)
a.riyaza at 2007-7-14 22:22:33 > top of Java-index,Desktop,Core GUI APIs...
# 5
Sorry for not being clear. I'd like to open Windows Explorer.I will have a directory path, and i need to open windows explorer to that directory, not IE.
llpindda at 2007-7-14 22:22:33 > top of Java-index,Desktop,Core GUI APIs...
# 6

Ok looks like this works...

public class Run {

public static void main(String[] args) throws Exception

{

Process p = Runtime.getRuntime().exec("explorer.exe THE\\PATH\\HERE");

p.waitFor();

System.out.println("Done.");

}

}

Thanks for everyones help!

llpindda at 2007-7-14 22:22:33 > top of Java-index,Desktop,Core GUI APIs...
# 7
On a related note, how would one open the OS's default browser?
timrba at 2007-7-14 22:22:33 > top of Java-index,Desktop,Core GUI APIs...