2

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"};
1
  • Usually it's best to stick to a single question per ... well, question. I see two here: One about classpaths, the other about Runtime.exec. Commented Oct 16, 2012 at 6:40

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.