How can java run the jar package directly or java-cp run the jar package
This article mainly explains "java how to run jar package directly or java-cp run jar package", the explanation content in the article is simple and clear, easy to learn and understand, please follow the idea of Xiaobian slowly in-depth, together to study and learn "java how to run jar package directly or java-cp run jar package"!
1. First, write a good class, in which the main method is defined:
2. Make sure the code runs inside the local eclipse:
3. Use eclipse to package runable jars:
View package files:
3. Copy the jar package exported in the above steps to java environment (copy to linux in this demonstration):
Run Results:
Thank you for reading, the above is "java how to run jar package directly or java-cp run jar package" content, after the study of this article, I believe we have a deeper understanding of java how to run jar package directly or java-cp run jar package this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!