Reputation: 3241
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.
Upvotes: 0
Views: 409
Reputation: 10762
You probably aren't seeing the errors from your Process
because they are sent to its own error stream. You can access the error stream using process.getErrorStream()
.
I suspect the problem is that your classpath isn't properly set when invoking the java
executable and it is failing to find your class or its dependencies, but it is hard to tell without seeing the error.
Upvotes: 3