Posted 09 March 2012 - 09:48 PM pbl, on 09 March 2012 - 09:43 PM, said:And your ResitorFrame class has a main() method ? This has always worked. This post has been edited by carnivroar: 09 March 2012 - 09:52 PM Was This Post Helpful? 0 Back to top MultiQuote Quote + Reply #10 pbl There is nothing So in the first try, I go there and execute java command to launch my program, as seen below: C:\Users\WINDOWS 8\workspace\Demo\target\classes\dto>java HelloHP Error: Could not find or load main class HelloHP Source
java -cp . In some cases, licensing agreements don't permit the contents of a jar file to be unpacked and repackaged "flat" into your product; for instance, this makes it very hard to determine How to include module's CSS in CMS pages with module block Is すごく怖 bad, or good? If your class is inside a non-default package e.g. "dto" in our case then compiler the will put the HelloHP.class file, which contains Java bytecode in a directory named "dto". http://stackoverflow.com/questions/9612918/could-not-find-the-main-class-error-when-running-jar-exported-by-eclipse
So, when did you get the "can't find main method" error? How can I tell whether a generator was just-started? I commented out the package statement in the source and added "-cp ." to the java command. I would also recommend looking >closely at how other complex java applications are packaged and distributed. >(E.g., Eclipse is packaged as a .zip file, that the user manually unpacks >during "installation".)
However, if I go outside of Eclipse and open a command prompt, navigate to the directory, and type in java -jar myjar.jar ClassName, I get this error message: Exception in thread Eclipse Runnable Jar Could Not Find Main Class 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 Strange how I never saw any of these errors > when running inside Eclipse. Posted 09 March 2012 - 09:38 PM Yes here it is Manifest-Version: 1.0 Class-Path: .
Glad to hear that functionality has been added and that it worked for you. I check only "export class files with compile warnings", I do get some compile warnings. Could Not Find Or Load Main Class Jar Command Line And if this is not allowed, it would have been nice if Eclipse extracted the inner JARs. Error Could Not Find Or Load Main Class Jar Linux Solving Error: Could not find or load main class HelloWorld Unfortunately beginner's book like Head First Java, which many developers used to learn Java, doesn't teach you how to deal with
I have a folder on my desktop called 'opennlp' where my .class file is in.So, I followed the instructions and in my command line returned to the desktop to run the http://gsbook.org/not-find/jar-could-not-find-the-main-class-bluej.php Thanks for trying to help though. HelloHPError: Could not find or load main class HelloHP[[email protected] sample]$ javac HelloHP.java[[email protected] sample]$ java -cp . To correctly format a MANIFEST.MF file, you need a Manifest-Version, a Class-Path, and a Main-Class. Jar Cannot Find Main Class
Posted 10 March 2012 - 12:44 PM Something was wrong with my java installations. Your manifest file should have this line of code Main-Class: YourPackage.DPMain Alternatively, you can do the following. Report message to a moderator Re: Program runs, but cannot export to JAR [message #250548 is a reply to message #250544] Thu, 10 January 2008 01:02 Eclipse User Originally http://gsbook.org/not-find/jar-file-could-not-find-the-main-class.php Eclipse did not include the text file, it only included the the binary files.
you saved me... Java Jar Could Not Find The Main Class Report message to a moderator Re: Program runs, but cannot export to JAR [message #250544 is a reply to message #250540] Thu, 10 January 2008 00:41 Eclipse User Originally thanks :) –S Gaber Jun 14 '12 at 11:50 add a comment| up vote 0 down vote I know this is a bit of a thread necro, but I was having
Is it bad form to write mysterious proofs without explaining what one intends to do? Any ideas what is causing this error and how I can fix it? Stuart A. Could Not Find Or Load Main Class Jar Maven asked 4 years ago viewed 57532 times active 1 year ago Get the weekly newsletter!
JDK 6) but an old version of JRE (e.g. 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 I'm suspecting a problem with your launch configuration in Eclipse, given that (from the next part of your post) it seems that at the command line java is able to find Check This Out Was This Post Helpful? 0 Back to top MultiQuote Quote + Reply #8 pbl There is nothing you can't do with a JTable Reputation: 8375 Posts: 31,956 Joined: 06-March 08
How to block Hot Network Questions in the sidebar of Stack Exchange network? After you find this folder, open it, again, by using the little white tab to the left of it. We are getting the "Error: Could not find or load main class" with the sched task user. To check this, you can execute the following two commands.
Could aliens colonize Earth without realizing humans are people too? I've seen people before make temporary solutions on issues, that is no way to solve something. I am not sure how to handle the two JAR libraries needed for my > program. This is due to issues with the way java handles its classpath loading.
You said earlier that "This works fine when executing in eclipse, but when I export to JAR file, I get the error mentioned above." But now you're saying that the error Most of the time you just need to either correct your CLASSPATH environment variable or run your program with java -cp or -classpath option. Now delete the run config of your main class that you are trying to run. Anyhow, you need to look for a folder called HKEY_CLASSES_ROOT.
Campbell Ritchie Sheriff Posts: 51659 87 posted 2 years ago 1 Shows that old posts can be useful Ike Gentz Greenhorn Posts: 15 posted 2 years ago Campbell Ritchie wrote:Shows Also check which program is associated with .jar files in your OS. Not the answer you're looking for? Half of the problem is solved when you are able to reproduce it.
posted 5 years ago I'm back... I have purposefully chosen a class with a package instead of HelloWorld in the default package because many programmers get "Could not find or load main class" error when they try