java.lang.Win32Process error
843798Mar 3 2003 — edited Apr 25 2003I'm trying to execute Windows Command Shell commands (e.g. chdir, rmdir) with the following statement:
proc = Runtime.getRuntime().exec( cmd ); where _cmd is a command like: chdir /d e:\temp
This works for applications (e.g. ss.exe - Visual SourceSafe command line interface), but does not work for Windows Shell commands as mentioned above. I get an exception back:
Exception in thread "main" java.io.IOException: CreateProcess: CHDIR /d e:\tmp error=
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Win32Process.java:63)
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 AppRunner.run(AppRunner.java:114)
at play.main(play.java:46)
I'm relatively new to Java programming. It doesn't look like the Runtime.exec is sending the CHDIR command in a way that Windows (2000 Professional in this case) thinks it is a Windows command (vs. an application cmd line). I would guess this is a problem that has been encountered before.
Thanks in advance for your help....