This question has been asked before but with no real answer.
I wan’t to start a Java Progam form another Java Program.
In my case I wan’t to start the same program(2) and then exit the original program(1) while the clone is still open.
Unfortunatly I can’t get this to work with ProcessBuilder
ProcessBuilder processBuilder = new ProcessBuilder("java","Programm");
Process process = processBuilder.start();
No error message, nothing happens.
I also can’t run the program from the CMD in windows.
javac shows several errors during compilation:
symbol not found, …
I can start the program normally from Eclipse.
You probably aren’t seeing the errors from your
Processbecause they are sent to its own error stream. You can access the error stream usingprocess.getErrorStream().I suspect the problem is that your classpath isn’t properly set when invoking the
javaexecutable and it is failing to find your class or its dependencies, but it is hard to tell without seeing the error.