Java exec Jar__java

Source: Internet
Author: User

Today, when you're learning maven, you need to execute the jar file that Maven builds correctly, so you need to execute the jar file to see if the results are correct.

The catalog results for the MAVEN project are as follows:



The working directory for Eclipse is under E:\workspace\EX11, as shown in the following illustration:



The jar file built by Maven is in the target directory with the name Helloworld-0.0.1-snapshot and executes the following commands directly under DOS:

E:\workspace\ex11\helloworld\target>java-jar Helloworld-0.0.1-snapshot.jar
There is no master manifest attribute in Helloworld-0.0.1-snapshot.jar

e:\workspace\ex11\helloworld\target>

The result is that there is no main list attribute in the jar, and the last search was made on the Internet. You can use the-CP command as follows:

JAVA-CP Yourjarfilename.jar Fullpackagename. ClassName

Re-execute using-CP with the following command:

E:\WORKSPACE\EX11\HELLOWORLD\TARGET>JAVA-CP Helloworld-0.0.1-snapshot.jar COM.R
icky.maven2.App maven
Hello World maven!

E:\workspace\ex11\helloworld\target>


Hello World came out, the execution jar was successful.

Finally, attach a complete description of-jar in the JDK







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.