Home java Error: Invalid or corrupt jarfile how to fix

Error: Invalid or corrupt jarfile how to fix




I have a javafx project, I made a jar file like this: in the project structure I selected Artifacts – & gt; clicked plus – & gt; JAR – & gt; from modules with dependencies . Next, I indicated where my Main class is. After that, I created a jar file. I click on it and there is the following error: Error: Invalid or corrupt jarfile . How to fix it?

File manifest.mf

Manifest-Version: 1.0
Main-Class: Graphics

Project structure:

Answer 1, authority 100%

Generally idea generates a Manifest file in the wrong directory. You need to put it in resources

Answer 2, authority 17%

If this error occurs, then you must:

  1. Move the META-INF folder with the MANIFEST.INF file to the resources
  2. folder

  3. Press Build Project (Ctrl + F9)
  4. After building press Run (Ctrl + F10)
  5. Check if your code is executed correctly (in most cases the error disappears)

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions