开发者

How to execute jar with command line arguments [duplicate]

开发者 https://www.devze.com 2023-03-22 04:03 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Passing arguments to JAR which is required by Java Interpreter
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Passing arguments to JAR which is required by Java Interpreter

how to provide command line input to a file which is in a jar I have a jar file hello.jar with some say execute.java file which 开发者_JAVA技巧i want to execute from command line with two arguments;how can i achive this i have mentioned a executable.java as a main class in a manifest file and using ant i have to run this file from ant run with command line arguments

Thanks and Regards samarth


Try this in the command shell:

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

Do it in Ant with the <java> built-in task:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消