I need to run command using Runtime.exec() :
java -cp .:/s/v-lib/* tDesigner -inRs /scg.rsp -out /g.plan;
here i need to add all the jars present in /s/v-lib directory to my class path. Do i need to add them individually?
tDesigner is my class.
-inRs /scg.rsp -out /g.plan are the arguments to the class.
what will be the correct way to construct command string?
is this correct:
String[] command = {"java", "-cp", ".:/s/v-lib/*", "tDesigner" ,"-inRs", "/scg.rsp" ,"-out", "g.plan"};
Tim Bender
20.5k2 gold badges52 silver badges59 bronze badges
asked Oct 16, 2012 at 6:34
user1731553
1,9376 gold badges23 silver badges33 bronze badges
1 Answer 1
The invocation of exec() looks correct.
Regarding the classpath, since java 1.5 you may specify a directory (rather than jars) in the classpath, in which case all jars found there are added to the classpath.
Joey
357k88 gold badges705 silver badges700 bronze badges
answered Oct 16, 2012 at 6:40
Sign up to request clarification or add additional context in comments.
Comments
lang-java
Runtime.exec.