Runtime.getRuntime().exec(
Hi,
Based on XML-files, my webservice generates java sourcecode.
If I compile this code manually, it compiles without errors.
However if the service tries to compile it, the spawned process returns with exitvalue() 1
String os_name = System.getProperty("os.name");
String shell = null;
String shellParam = "";
String classPad = java.lang.System.getProperty("java.class.path");
if (os_name.startsWith("Windows")) {
if ( (System.getProperty("os.name").endsWith("NT"))
|| (System.getProperty("os.name").endsWith("2000"))
||(System.getProperty("os.name").endsWith("XP")) ) {
shell = "cmd.exe";
} else {
shell = "command.com";
}
shellParam = "/C";
}
String [] commando = {shell,
shellParam,
"javac",
"-Djava.ext.dirs=" +startPad +File.separator+ "WEB-INF" +File.separator+ "lib",
"-classpath \"" +classPad+"\"",
"-verbose",
File.separator +"minlnv" + File.separator +"pdf" + File.separator + srcStub};
String [] commandEnv = {"JAVA_HOME=\"C:" +File.separator+ "Program Files" +File.separator+ "Java" +File.separator+ "jdk1.5.0_06\""};
Process p = Runtime.getRuntime().exec(commando, commandEnv, new File(startPad));
try {
p.waitFor();
System.out.println("outPut exec.ret " + p.exitValue());
} catch (InterruptedException e) {
System.out.println(e.getMessage());
int ret = p.exitValue();
e.printStackTrace();
}

