Could Not Find Main Class Error Jar
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies
Could Not Find Or Load Main Class Jar
of this site About Us Learn more about Stack Overflow the company could not find or load main class jar file Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges could not find or load main class jar maven Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:
Could Not Find Or Load Main Class Eclipse
Sign up JAR file: Could not find main class up vote 2 down vote favorite Okay, I have a strange problem. I wanted to run one of my programs as a .jar file, but when I open it by double-clicking it, I get an error message like "Could not find main class, program is shutting down". I'm pretty sure I did everything
Could Not Find Or Load Main Class Jar Command Line
right, the jar should work afaik. I also tried other programs, it's the same with every single one. (I'm creating the .jar's through BlueJ) There is no problem when I run them through a .bat . And here comes the strangest thing of all: The .jar's have worked some time ago (one or two months I guess), and I don't remember doing anything different. It's the same BlueJ-Version. Okay, maybe Java updated and something got messed up... I googled, but I couldn't find a solution. (some people seem to have a similar problem, and it seems to be only them who can't run their .jar's; they uploaded them and other people say the .jar's run fine.) What could be the problem? How can I solve it? I'd really appreciate some help here. Thank you :) ApertureT3CH EDIT: okay guys, you're making me unsure here. Imma check the manifest again, at this unholy time ( 1:34 am ) :P EDIT2: This is my MANIFEST.MF Manifest-Version: 1.0 Class-Path: Main-Class: LocalChatClientGUI [empty line] [empty line] The Main class is correct. EDIT3: Thanks to hgrey: There is
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss could not find or load main class while executing jar file the workings and policies of this site About Us Learn more about
Executable Jar Could Not Find The Main Class
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions error could not find or load main class jar linux Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. http://stackoverflow.com/questions/10149463/jar-file-could-not-find-main-class Join them; it only takes a minute: Sign up Could not find or load main class with a Jar File up vote 13 down vote favorite 2 I'm trying to load a jar using @echo off java -jar Test.jar pause With the manifest of Manifest-Version: 1.0 Main-Class: classes.TestClass In the Jar directory, I can clearly see a classes\TestClass http://stackoverflow.com/questions/13030675/could-not-find-or-load-main-class-with-a-jar-file file when I extract it. Edit: classes.TestClass does have a public static void main(String[] args). Package Deceleration in classes.TestClass is package classes; But I still keep getting the error message Could not find or load main class classes.TestClass I've been through everything I've been able to find with this problem, and none of it seems to help. I've tried editing the classpath, redoing the manifest, installing the new JRE. What else should I be doing? java class jar main share|improve this question edited Jan 14 '15 at 20:31 jww 34.9k21109221 asked Oct 23 '12 at 12:43 Austin 2,77242144 1 Does TestClass contain a main function? –Baz Oct 23 '12 at 12:44 @Baz Yes, it has a main method. –Austin Oct 23 '12 at 12:45 2 Are you sure that the package name for TestClass is classes? –Hakan Serce Oct 23 '12 at 12:46 is the TestClass in the package classes? I would suggest run the file from command line once. If success then move ahead. –Arham Oct 23
Site Careers Other all forums Forum: Java in General Fixes for "Error: Could not find or load the", or .jar doing nothing on double clicking Richie Robert Greenhorn Posts: 1 posted 4 years ago So, if you are here in this thread, you are probably https://coderanch.com/t/584004/java/java/Fixes-Error-find-load-jar getting the error "Error: Could not find or load the main class (name).jar", or your .jar is doing nothing when you double click on it to start it. I'm going to be discussing in this thread possible reasons http://www.dreamincode.net/forums/topic/268538-jar-files-could-not-find-the-main-class/ these issues are happening, and how to fix them. Issue 1: MANIFEST.MF So, the first thing I'm going to be discussing is a problem with the manifest file. The manifest file, is a file within any supposively runnable could not .jar file. It's always in a folder called META-INF and is named MANIFEST.MF. Naturally, the .MF file extension stands for Manifest File. Moving on from that, the normal architecture of a manfiest file, you will find, is similar to this: Manifest-Version: 1.0 Class-Path: . Main-Class: convert.Main This is a typical manifest file. As you can see, it has a version, a Class-Path, and a Main-Class section, the Main-Class section is what we are going to be focusing could not find on. When you attempt to start up your jar file by double click, and nothing happens(javaw.exe), or you get the error(java.exe) "Error: Could not find or load the main class (name).jar", then there may indeed be a problem with your manifest file. Note, it is only a problem with your manifest file IF you can not run the jar file from command prompt as well, if you can run the jar file from command prompt fine, skip to the next section of this tutorial. Anyhow, there is several problems the manifest file may have to cause java to not recognize the location of the main class from the manifest file. Problem 1: Main-Class is set to the incorrect main class In this issue, the Main-Class of the MANIFEST.MF may be set to the incorrect Main Class file Say for example, my main class is here in my jar file: C:\Users\Ryan\Desktop\Image to ASCII.jar\convert\ That means that my Main-Class would be convert.Main, since the path to my main class is: C:\Users\Ryan\Desktop\Image to ASCII.jar\convert\Main.class In specifying the main class for the MANIFEST.MF, you must use dots instead of slashes to specify folders. For example, there is one folder to go into to reach Main.class, that folder is called convert, which is my package, so to reach Main.class, for the Main-Class section of my MAINIFEST.MF, I would have convert.Main. Under Main-Cl
of 1 New Topic/Question Reply 5 Replies - 11855 Views - Last Post: 27 February 2012 - 01:40 PM Rate Topic: #1 Achri D.I.C Head Reputation: 8 Posts: 52 Joined: 18-June 11 .JAR files - Could not find the main class Posted 27 February 2012 - 12:43 PM Yesterday I spent a fair amount of time building a Temperature converter using SWING. On exporting the .JAR file in Eclipse, when I dclick the .JAR file it says "Could not find the main class: TempConversion.TempConversionMain. Program will exit." My first thought was the manifest file. So I checked it and I actually had not selected the main class at the end of the .JAR wizard. After fixing that I still received the error. My manifest: Manifest-Version: 1.0 Main-Class: TempConversion.TempConversionMain It does contain a whitespace/nl at the end of the manifest. 1. I created a .JAR file last week with no problems using the same wizard in Eclipse 2. I imported the project into NetBeans and created the exact same .JAR file. Still does not work. 3. I manually navigated my way with the Windows console to the folder and created the exact same .JAR file using console commands, and still doesn't work. 4. I sent the .JAR file to my other two computers, and gives the same error on those. 5. I created a simple helloWorld just to see if it was my code(and yes I accidentally capitalized the o in world): package helloWorld; public class HelloWOrld { public static void main(String[] args) { System.out.print("Hello World"); } } The helloWorld manifest: Manifest-Version: 1.0 Main-Class: helloWorld.HelloWOrld //there is a white space here in the manifest "Could not find the main class: helloWorld.HelloWOrld. Program will exit." 6. I've searched and searched, but 90% of the results are people learning java and creating a .JAR for their first application. I've spent close to 5 hours trying to figure this out. 7. My Eclipse export .JAR wizard se