Creating Jar with Intellij 2016 – No main manifest attribute

Tags: , ,



I am getting no main manifest attribute while running the jar create by Intellij. I extracted the jar and observed that there was another manifest file, not the one I had specified while creating artifact.

When I open manifest in IDE, it displays everything right but after creating jar I get a whole new manifest file.

Manifest-Version: 1.0
Main-Class: YoutubeList

I tried every solution from other answers and still not getting it right. Why creating a simple jar is hell of a task in Intellij, it was supposed to help developers!

Edited

And sometimes it does not include .class files in Jar which results in could not found or load class

Answer

I was stucked with the same problem with maven build. When you are creating the artifact from project structure settings (ctrl+alt+shift+S), you have to change manifest directory:

<project folder>srcmainjava 

change java to resources

<project folder>srcmainresources

I have also used the option extract to the target JAR, and it’s working well.

EDIT

You can find a detailed step-by-step, an other solutions here: https://stackoverflow.com/a/45303637/2640826



Source: stackoverflow