Alex Rivera | Logout

Create an excutable jar in IntelliJ IDEA

Asked 2013-06-10T13:10:50.113
15

I am using IntelliJ IDEA 12.1.3. I have one module and I am trying to convert it into a jar as per the steps given here. I built the jar file and I moved the jar file to D:/. If I try to run this jar I get the following message:

Failed to load Main-Class manifest attribute from jar

If I run it using java -classpath jar com.code.TestCase it works perfectly.

Why does this happen? I created the jar using IntelliJ IDEA. In that jar it has all the code for all external libraries which I added.

In the src manifest file:

Manifest-Version: 1.0
Main-Class: com.code.TestCase

but the jar's manifest file content is:

Manifest-Version: 1.0
Build-Jdk: 1.6.0
Built-By: ubuntu
Created-By: Apache Maven
Archiver-Version: Plexus Archiver

Name: org.apache.log4j
Implementation-Vendor: "Apache Software Foundation"
Implementation-Title: log4j
Implementation-Version: 1.2.15

Why is Main-Class not added in the jar file MANIFEST.MF, but it has Main-Class in src?

Edit
Report

1 Answer

0
answered 2013-06-10T13:22:38.983

Your Answer