Could Not Find The Main Class Jar Error
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 of this site error could not find or load main class jar About Us Learn more about Stack Overflow the company Business Learn more about error could not find or load main class jar hadoop hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss error could not find or load main class jar eclipse 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: Sign up “Could not find the error could not find or load main class jar linux main class” error when running jar exported by Eclipse up vote 15 down vote favorite 9 I have a java project that works perfectly fine when running it from within Eclipse. When I try to export it to either a "JAR file" or "Runnable JAR file" the .jar file is created, but when I double click on it to try to run the program it
Error Could Not Find Or Load Main Class Jar File
gives me an error that says "Could not find the main class: package.MainClassName. Program will exit." As I mentioned, I tried exporting to both JAR options, I specified the correct class that the main method is in, and when I look through the actual files in the .jar file everything seems to be in order -- the manifest looks something like: Manifest-Version: 1.0 Main-Class: package.MainClassName (blank line) and is in the META-INF folder. There is a folder with my package name, which contains all the .class files, including the class that contains the main method. A few image and text files that I use also appear in the jar file. The actual program isn't anything too complicated -- it's a simple "snake" game using Swing (plus the code all works when run from inside Eclipse). Any ideas what is causing this error and how I can fix it? Let me know if there's any other information I should provide. java eclipse swing jar executable-jar share|improve this question edited Mar 8 '12 at 6:10 asked Mar 8 '12 at 4:32 scaevity 1,38672446 What is the fully qualified name of the main c
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn
Could Not Find Main Class Jar Executable
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags could not find or load main class jar maven Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, java jar could not find the main class helping each other. Join them; it only takes a minute: Sign up .jar error - could not find or load main class up vote 14 down vote favorite 2 I tried to put HelloWorld in a .jar file http://stackoverflow.com/questions/9612918/could-not-find-the-main-class-error-when-running-jar-exported-by-eclipse and running it, but it doesn't work. I created the java file and typed in the program, and then wrote in cmd: javac HelloWorld.java java HelloWorld and it worked. Then I entered echo Main-Class: HelloWorld >manifest.txt jar cvfm HelloWorld.jar manifest.txt HelloWorld.class and got the output added manifest adding: HelloWorld.class(in = 426) (out= 288)(deflated 32%) I then entered java -jar HelloWorld.jar HelloWorld.jar and the first line worked, while the second line gave me an error: Error: Could not http://stackoverflow.com/questions/21650851/jar-error-could-not-find-or-load-main-class find or load main class path\HelloWorld.jar which is the same output I got (in a rapidly closing window) when I tried to open it with the java.exe file in 64 bit jre7\bin, jdk1.7.0_51\bin, jdk1.7.0_51\jre\bin, as well as 32 bit jre7\bin. I've uninstalled and reinstalled both my jre and jdk and recreated my .class and .jar files, but the problem persists. I'm on win8. Edit: I tried to do as aetheria suggested, but no luck. I put HelloWorld.java in path\com\stackoverflow\user\blrp, compiled it, and it worked by entering java com.stackoverflow.user.blrp.HelloWorld in path. I then created the manifest and jar by: (echo Manifest-Version: 1.0 echo Class-Path: . echo Main-Class: com.stackoverflow.user.blrp.HelloWorld) >manifest.txt jar cvfm HelloWorld.jar manifest.txt com\stackoverflow\user\blrp\HelloWorld.class and got the output added manifest adding: com/stackoverflow/user/blrp/HelloWorld.class(in = 454) (out= 312)(deflat ed 31%) but still, java -jar HelloWorld.jar worked and HelloWorld.jar didn't (same error). I also tried not doing the package thing, just the Class-Path in manifest, same result. (Also, I solved the problem prior to asking the question by use of a .bat file, but it'd still be sweet to get that jar working.) java jar share|improve this question edited May 10 '14 at 20:56 connor 32.8k1596118 asked Feb 8 '14 at 19:35 Blrp 3941421 manifest should be packaged as /META-INF/MANIFEST.MF unzip any jar file to see example e.g jre/lib/rt.jar –jbaliuka Feb 8 '14 at 22:17 print e
This Site Careers Other all forums Forum: Java in General Executable jar Could not find the main class Jo Young Ranch Hand Posts: 34 https://coderanch.com/t/541296/java/java/Executable-jar-find-main-class I like... posted 5 years ago I'm back... I've had this http://gatkforums.broadinstitute.org/gatk/discussion/5973/could-not-find-or-load-main-class-but-my-classpath-looks-correct problem once already when I only had one class in the jar, I went back and added a second class to make it user friendly because I realized that the way I wrote it originally in order for the user to turn off the program could not they would have to go into task manager and stop javaw.exe process... so I made a second class that has Swing on it and creates a window... and now it is having the problem of not being able to find the main class that is in the manifest again... and I have tried everything that I could not find was directed to do the last time that finally got the other one fixed as well as all the different things that didnt work last time and it keeps giving me the same error... currently I have... C:\JarFile>C:\Oracle\Middleware1013\jdk160_18\bin\jar -tf PushupTimer.jar META-INF/ META-INF/MANIFEST.MF myTimer.class timeClock.class C:\JarFile>C:\Oracle\Middleware1013\jdk160_18\bin\jar -xf PushupTimer.jar META-INF/MANIFEST.MF Manifest-Version: 1.0 Created-By: 1.6.0_18 (Sun Microsystems Inc.) Main-Class: myTimer any ideas? I tried setting Main-Class to Timer.myTimer and saving the class files to Timer.myTimer.class and Timer.timeClock.class (the package name for the classes is Timer so I thought that maybe having the files saved by just their class names and then it gets into the class and it is in a package might have been the problem... this was not the case) Jesper de Jong Java Cowboy Saloon Keeper Posts: 15495 43 I like... posted 5 years ago Maybe this is the problem: Make sure there is an empty line at the end of the MANIFEST.MF file. There's a known problem where Java will not interpret the las
team GATK Documentation Guide Tutorials FAQs Presentations Common Problems Methods and Algorithms Dictionary Pipelining with Queue Developer Zone Archive Tools related to GATK MuTect v1 MuTect v1 Documentation ReCapSeg ReCapSeg Documentation Oncotator Oncotator documentation GenomeSTRiP GenomeSTRiP Documentation XHMM Firepony Base Recalibrator search subcategories search archived Tags What to search discussions questions comments answers groups Date within 1 day 3 days 1 week 2 weeks 1 month 2 months 6 months 1 year of Examples: Monday, today, last week, Mar 26, 3/26/04 Search Howdy, Stranger! It looks like you're new here. If you want to get involved, click one of these buttons! Sign In Register Categories Recent Discussions Activity Best Of... Unanswered Groups Categories 6.4K All Categories184 Announcements 5.5K Ask the GATK team 205 GATK Documentation Guide 30 Tutorials 44 FAQs 12 Presentations 11 Common Problems 32 Methods and Algorithms 18 Dictionary 1 Pipelining with Queue 29 Developer Zone 28 Archive 450 Tools related to GATK 128 MuTect v1 11 ReCapSeg 36 Oncotator 246 GenomeSTRiP 26 XHMM 3 Firepony Base Recalibrator Powered by Vanilla. Made with Bootstrap. "Could not find or load main class", but my classpath looks correct jason.harris Menlo Park, CAPosts: 12Member ✭ August 2015 edited August 2015 in GenomeSTRiP Trying to run SVPreprocess; I am getting "Could not find or load main class" on the SVCommandLine class. My setup looks correct to me, so I am hoping for some advice. Sanity checks: $ java -version java version "1.7.0_02" Java(TM) SE Runtime Environment (build 1.7.0_02-b13) Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode) $ echo ${SV_DIR} /nfs/projects/home/jharris/Code/svtoolkit $ java -jar ${SV_DIR}/lib/SVToolkit.jar SVToolkit version 2.00 (build 1602) Build date: 2015/07/21 09:43:14 Web site: http://www.broadinstitute.org/software/genomestrip unzip -v ${SV_DIR}/lib/SVToolkit.jar | grep SVCommandLine 8299 Defl:N 3874 53% 07-03-2015 11:16 c59d5638 org/broadinstitute/sv/main/SVCommandLine.class Here is my command line: java -Xmx4g \ -cp ${SV_DIR}/lib/SVToolkit.jar:${SV_DIR}/lib/gatk/GenomeAnalysisTK.jar:${SV_DIR}/lib/gatk/Queue.jar \ org.broadinstitute.gatk.queue.QCommandLine \ -S ${SV_DIR}/qscript/SVQScript.q \ -S ${SV_DIR}/qscript/SVPreprocess.q \ -cp ${SV_DIR}/lib/SVToolkit.jar:${SV_DIR}/lib/gatk/GenomeAnalysisTK.jar:${SV_DIR}/lib/gatk/Queue.jar \ -gatk ${SV_DIR}/lib/gatk/GenomeAnalysisTK.jar \ -configFile ${SV_DIR}/conf/genstrip_parameters.txt \ -R ${SV_DIR}/1