Intellijidea hit executable jar package

Source: Internet
Author: User

There was a problem when working with Intellijidea 16 to package a Java program into an executable jar package.

Error:invalid or corrupt jarfile project.jar problem, unable to run JAR package

Workaround:

My final requirement is to make the program and external dependencies into a runnable jar package instead of separating the program and dependencies, so select artifacts in file---Project Structure, click +, select Jar, select from modules with Dependencies.

Come out like:

  

In main class, select the class that contains the main method that is ultimately running in the program. Since I want to make external dependencies and programs into a jar package, select the first one in the jar files from libraries and choose the second if you want to separate the program and dependencies from the jar package.

In directory for meta-inf/manifest. MF needs to add resources at the end, the default is no, and the resources file will cause the final jar package to not run (for specific reasons not yet found ...). )

Click OK, then go all the way by default. Finally, build on the external select build, build artifacts, and then run under the generated Jar package directory: Java-jar project.jar command.

Intellijidea hit executable jar package

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.