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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.