Amara
Amara

Reputation: 14299

Running jar file with source files in another directory

I would like to run a jar file right from the command line without having to put the jar file in the directory containing my input files. Any ideas on how I can do this if it is possible?

Upvotes: 0

Views: 2413

Answers (1)

toddk
toddk

Reputation: 871

Wouldn't you just supply a class path argument when executing the class inside of the JAR? For example:

java -cp lib/somejar.jar org.foo.bar.MyClass

Where -cp is the classpath argument and lib/somejar.jar is the path to the jar you are trying to execute.

I'm not sure I'm clear on what you're looking for.

Upvotes: 3

Related Questions