Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Runtime.exec() returns err=2 on CreateProcess

0 views
Skip to first unread message

Albert Lee

unread,
Oct 29, 1996, 3:00:00 AM10/29/96
to

I am trying to create a process to run another instance of java like:
==========
import ibmsf.gf.*;
import java.util.*;
import java.lang.*;
import java.io.*;

public class test {
public static void main ( String argv[] ) throws Exception {
Process p;
try {
String cmd = "start command /c java ibmsf.gf.Test";

System.out.println( "cmd = " + cmd );

p = Runtime.getRuntime().exec( cmd );
} catch ( IOException e ) {
System.out.println( "Unable to execute command - " +
e.getMessage() );
throw e;
}
}
}
==========

It works in Win/95 but when I try to do the same thing in the NT 4.0
server, it failed with the following messages:

==========
cmd = start cmd /c java ibmsf.gf.Test
CreateProcess: start: Could not execute (err = 2)
Unable to execute command - CreateProcess
java.io.IOException: CreateProcess
at java.lang.Win32Process.<init>(Win32Process.java:56)
at java.lang.Runtime.exec(Runtime.java:103)
at java.lang.Runtime.exec(Runtime.java:73)
at test.main(test.java:14)
==========

I can run the same command in a command line and it works:

c:> start command /c java ibmsf.gf.Test

When I debug the Runtime class exec method(), it branches off to a
native method execInternal(cmdarray, envp) to do the process creation.
I assume that it indirectly invokes the Win32 API to perform the
CreateProcess API functions. The CreateProcess API takes about 10
parameters
which specified environemnt, security, etc. The Java NT runtime must
specified
these parameter in the Win32Process code which can not be found anywhere
else.

Questions:
1. What is the err=2 means?
2. Is this a problem relates to some security/authentication/user
management on
the NT server?
3. What do I need to do to make the simple java program to work?

Any helps are appreciated.
___________________
Albert Lee
al...@vnet.ibm.com
___________________

0 new messages