How to jar with command line arguments

Possible duplicate:
Passing JAR Arguments Required by Java Interpreter

how to provide command line input to a file that is in the bank I have a hello.jar jar file with some execute.java file that I want to execute from the command line with two arguments, how can I achieve this I mentioned the .java executable as main class in the manifest file and using ant I have to run this file from ant run with command line arguments

Thanks and Regards Samarth

+7
source share
1 answer

Try this in the shell:

java -cp your-classpath-dependencies-here -jar hello.jar "arg1" "arg2" 

Do this in Ant using the built-in <java> task:

http://ant.apache.org/manual/Tasks/java.html

+20
source

All Articles