2

I know that there were a lot of subjects like this one, but I didn't find answer at my question. I had created JAR file in IntelliJ in project structure and artifact is builded. In Java folder I have got package META-INF with MANIFEST.MF:

Manifest-Version: 1.0
Main-Class: com.przemyslawostrouch.hellowworldspring.Hellowworldspring
 Application

but when I would like to execute JAR file (java -jar HelloWorldSpringTutorial.jar) in cmd line I received information: no main manifest attribute, in HelloWorldSpringTutorial.jar.

So should I add it to the JAR in IntelliJ manualy?

EDIT: CrazyCoder give a good instruction that META-INF should be in resourse folder, but my IntelliJ default setup created it in src->main-> java folder at the beginning. After changing the directory to the resourse, everything work good.

przemekost
  • 91
  • 2
  • 14
  • 1
    See http://stackoverflow.com/a/42200519/104891 for the sample projects and compare them to yours. Make sure `MANIFEST.MF` is indeed placed into the correct location inside the jar. You may need to keep it in the resources directory, not sources or your [artifact configuration](https://www.jetbrains.com/help/idea/artifacts.html) is incorrect. – CrazyCoder Sep 01 '17 at 22:26
  • I've been looking for your EDIT for 3 days over the internet! THANKS! That completely solved my problem, you should create an answer and mark it as the correct answer instead of having an EDIT in your question, cheers! – pgarciacamou Nov 15 '17 at 00:33

1 Answers1

0

I don't now IntelliJ but if you create a Jar with Eclipse, the manifest-file is created by Eclipse automatically, so I'd expect a manifest-file in the project itself will most likely be ignored. Check the settings available when creating the jar in IntelliJ if you can specify the main class.

After googling I came up with a help page that seems to confirm above theory.

Lothar
  • 5,323
  • 1
  • 11
  • 27