On Intellij 13, executable jar created is invalid or corrupted

Arthur Julião picture Arthur Julião · Apr 14, 2014 · Viewed 9.5k times · Source

I tried to create an executable jar from my project on Intellij 13 (win8), following these answers How to build jars from IntelliJ properly? and execute the jar created, then I get "Error: Invaid or corrupt jarfile" followed by the path of the jar.

My project is simple, but have multiple java files and an UI form.

I call Build|Build Artifacts|Jar after create jar artifact on Project Structure|Artifacts, after build.

I created the project with a maven scafold, but there are no dependencies on pom.xml.

I'm using java7. Is something missing?

Artifact

Answer

Marian Klühspies picture Marian Klühspies · May 17, 2016

Here is a quick solution WITHOUT pom.xml

I´ve solved it with the artifact settings of IntelliJ by creating a "META-INF" subfolder and copying the Manifest file inside.

I don´t know why this is even needed, but it seems that IntelliJ IDEA doesn´t include the META-INF folder by default

enter image description here

Pointing to the file:

enter image description here