Using Runtime.exec() to call a Java class with arguments
Posted on 2003-10-26
I need to independantly run a Java class (with arguments) from a current running Java class using Runtime.exec().
I can use the Runtime.exec() with 100% success when calling .exe programs (e.g. Runtime.exec("start rmiregistry.exe")) but when wanting to start another java program with arguments (e.g. Runtime.exec("java -Djava.security.policy=client.policy ProductClient")) or even without arguments (e.g. Runtime.exec("start java ProductServer")), it will not work.
I am also unsure on how to call another class from a different directory than the working one? e.g. using something along the lines of Runtime.exec("c:\rmi\start java ProductServer") when the java program calling that was run from c:\rmi\client)
Any advice or knowledge would be greatly appreciated!!