Reputation: 1937
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"};
Upvotes: 2
Views: 229
Reputation: 424983
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.
Upvotes: 1