About Runtime.exec...

Hi friends, i am trying to write a java class that launch ant target, this ant target will checkout some code from a remote subversion server the problem is that when i try to run the ant target using the runtime.exec()

method i get this error :

svn: Can't create socket

is there any one who can help me solving this problem?

[359 byte] By [jmeista] at [2007-11-27 2:29:19]
# 1
post the code please
ing.carlos.sa at 2007-7-12 2:42:23 > top of Java-index,Java Essentials,Java Programming...
# 2

Hi, thank you for reply. I post the code here:

String JAVA_HOME="R:/bin/sun/jdk1.4.2";

String ANT_HOME="R:/bin/ant1.6.5/apache-ant-1.6.5";

String [] env = new String []{

"JAVA_HOME="+ JAVA_HOME,

"ANT_HOME=" + ANT_HOME,

....other required env vars

};

File wdir = new File("c:/build");

String cmd = "cmd /c start " + ANT_HOME + "/bin/ant.bat checkout.trunc";

Process process = Runtime.getRuntime().exec(cmd, env, wdir);

int exitVal = process.waitFor();

jmeista at 2007-7-12 2:42:23 > top of Java-index,Java Essentials,Java Programming...
# 3
You should use: Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + command);where:command=" /c start " + ANT_HOME + "/bin/ant.bat checkout.trunc";
J@A@V@Aa at 2007-7-12 2:42:23 > top of Java-index,Java Essentials,Java Programming...
# 4
A made the required changes but unfortunally i get the same error,the network services are still not available for the process launched by the exec method.Any suggestion to fix this problem?
jmeista at 2007-7-12 2:42:23 > top of Java-index,Java Essentials,Java Programming...
# 5
did you try "cmd /k" ....
ing.carlos.sa at 2007-7-12 2:42:23 > top of Java-index,Java Essentials,Java Programming...
# 6
Hi friend, i am still blacked on this problem...I am wondering if using native code (jni) will let me run native exe programs from java class with full network support?
jmeista at 2007-7-12 2:42:23 > top of Java-index,Java Essentials,Java Programming...
# 7

> is there any one who can help me solving this problem?

Simple - your environment for the process you are running is not set up correctly.

Most likely it is a permissions problem.

Note that this has NOTHING to do with java. You need to fix it by understanding your OS (not java) and the implications of running a process and the environment in which it runs.

jschella at 2007-7-12 2:42:23 > top of Java-index,Java Essentials,Java Programming...