The Java program is packaged into a jar file with parameters and the instance code

Here, we use Apache commons cli to complete the target function. Without much nonsense, we can directly use the code

Required Maven dependencies

Here we post the main class code

Remember to put the above code into the main function and parse args [], so that our requirements can be realized after the program is packaged into a jar file.

Execute command:

If you forget what parameters you need to pass, you can pass them through Java - jar jarname Jar - H get parameter content

summary

The above is the Java program packaged into jar file example code with parameters introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>