简体   繁体   中英

How to run a java jar file with arguments and classpath in command promt

I have a jar file program.jar which requires a third party jar external.jar, I can run it with the following command:

java -cp -jar program.jar; external.jar

But I need to pass two arguments arg1 and arg2 to the program.jar's main function. How can I do it? Without the external.jar I know it can be done with

java -jar program.jar arg1 arg2

Thanks.

第三方库必须在类路径中:

java -cp  external.jar -jar program.jar arg1  arg2

Either make your jar as executable and execute the main method with arguments as you mentioned above. else

java -cp "<3PPjar files separated by separator>" args2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM