... También tengo Maven 3 y encontré algunas de las sugerencias en la web que no coinciden con el código maven usado con Netbeans también. Here we use the option set cvfeP. Otherwise it was including a manifest file in the jar, but not the one in -/src/main/java that it should have. If it's not an executable JAR, then you'll need to run the program with something like: where com.somepackage.SomeClass is the class that contains the main method to run the program. If you edit your manifest by hand be sure to keep the newline at the end otherwise java doesn't recognize it. However with this information you can perhaps get some better help (given the fact that you have the same problem as I). Featured on Meta Feedback post: Moderator review and reinstatement processes The top answer here (olivier-refalo thanx) looked like the right place to start but didn't help. In order to run the main method from our jar, we need to mention it inside the ‘Main-Class’ property of the manifest file (mainClass attribute in POM.xml in case of Mavenized application) which needs to be bundled with the code as well. You might have the same problem as I do. I got same error just now. This information was missing in the MANIFEST.MF.Below the content of this file before adding the maven-jar-plugin : From there it was easy: I just use that path (minus the ".class" suffix): Since you've add MANIFEST.MF, I think you should consider the order of Field in this file. How to fix Failed to load Main-Class manifest attribute from jar The Gradle answer is to add a jar/manifest/attributes setting like this: For maven, this is what solved it (for me, for a Veetle codebase on GitHub): I had this issue when creating a jar using IntelliJ IDEA. I personally think all the answers here are mis-understanding the question. I do not know how to solve it, though. the fix is to change the java_home in your shell bash profile to match the java version used to compile the project in eclipse. i used kali linux terminal but should be fine in all debian, Main-Class: Main Check your .jar file in a zip program. Update: I just found a really neat way to specify the Application's entry point in eclipse. But in this case, since the file is from an application, i cannot do that. no main manifest attribute, in "app.jar" ... Maven-based Netbeans 8.2 program. Any executable jar file Should run either by clicking or running using command prompt like java -jar app.jar (use "if path of jar contains space" - i.e. My problem was solved my moving META-INF to the resources folder. java -jar yourjar.jar my.package.Main. (What that class is depends on the program, it's impossible to tell from the information you've supplied). javascript - How to check a radio button with jQuery? To compile your code with your .class files ending up with the structure given by the package name use: The -d . See this discussion. This class is the one with the main method. But I guess it's fine as long as it works. (source). That should have been java -jar app.jar instead of java -jar "app".. makes the compiler create the directory structure you want. It's really a huge mess to specify this attribute inside the MANIFEST.MF file. Create a jar file using, While running the jar file simple run like this. Be aware of appending Main-Class entry on MANIFEST.MF file, check where you are saving it! Everyone knows that Spring Boot sets up a manifest like this, which varies from everyones asssumption that this is a standard .jar launch, which it may or may not be : Perhaps it needs to executed with org.springframework.boot.loader.JarLauncher on the classpath? Here is just the modified manifest block used: I found a new solution to bad manifest generation ! Differences between "java -cp" and "java -jar"? Take time to understand ! My env is java version "1.8.0_91". or whatever your main file name is (make sure to add package name if it exists), or you can go to propeties of file and check, it helped me while most of the above answers did not. Kindly let me know if you still have any issues. jar 파일을 실행할 수 없습니다:"no main manifest attribute" (20) (첫 번째 게시물 - 그래서 그것은 깨끗하지 않을 수 있습니다) 이것은 OS X 11.6, Maven 기반 Netbeans 8.2 프로그램에 대한 나의 수정입니다. end with a new line or carriage return. I recently just started toying around with Maven in java. / to get the class files from that folder, preserving the folder structure. Note that this is only the plugin definition, not the full pom.xml: (Pick a appropriate to your project.). If it is not able to find an entry,then it will complain with Unable to execute jar- file: “no main manifest attribute”.. MANIFEST.MF contains information about files contained in the Jar file. All rights reserved. You might face the unsupported java version error. java -cp was part of the answer, but I needed more specific info on how to identify the class to run. Having tried most all of the answers here and elsewhere to no avail, I returned to the art of "use what works". I had the same issue today. Up to now my app is 100% Netbeans - no tweaking (just a few shell escapes for the impossible!). This solution relates to Netbeans version 8.0.2 and earlier. When you run self-executable jar, java will look for the Main-Class in MANIFEST.MF file located under META-INF folder. But I am being unable to create an executable JAR file. i would like to share his solution here If you are unsure what to put here, just copy the Main Class settings from the Rub tab in your Netbeans Project Properties. In Java launch configuration, choose your main class. To fix this you need to edit your project’s pom.xml file. and does not contain the "Main-Class" declaration, then I think you found your problem. Recientemente empecé a jugar con Maven en Java. Hope this helps! I have installed an application, when I try to run it (it's an executable jar) nothing happens. Open the jar file with WinRAR. and add the following line: Open cmd and type: java -jar c:/path/JarName.jar. I also tried extracting the jar to see if I could find the main class, but there are to many classes and none of them has the word "main" in it's name. If the jar isn't following the rules, it's not an executable jar. The Main-Class attribute, and any required Class-Path , will be inserted into the JAR's manifest by the build process. For Maven, something like the following snippet should do the trick. Até agora meu aplicativo é 100% Netbeans - sem ajustes (apenas alguns escapes para o impossível! I'm not 100% sure if you can always assume the class you need is the first one, but it was for me. If u're using gradle, just add next one in ur gradle.build: Where com.company.project.MainClass path to ur class with public static void main(String[] args) method. you get “no main manifest attribute”. java - "Invalid signature file" when attempting to run a .jar. 1.Try restart the Eclipse (if you are using Eclipse to built JAR file) The last line will not be ). When I run it from the commandline with: Normally, if I had created the program myself, I would have added a main class attribute to the manifest file. The -jar option only works if the JAR file is an executable JAR file, which means it must have a manifest file with a Main-Class attribute in it. Não é possível executar o jar-file: "no main manifest attribute" (20) (primeiro post - então pode não estar limpo) Esta é a minha correção para o OS X 11.6, programa Netbeans 8.2 baseado em Maven.