Loading...
Home > Could Not > Java Error Could Not Find Or Load The Main Class

Java Error Could Not Find Or Load The Main Class

Contents

put all the referred jar files in a folder jarAddOns and copy it in a safe place now from eclipse (or from your IDE) remove the jar files . But why please? –Sam003 May 7 '15 at 17:21 it works because it tells the java interpreter where the bytecode class files are. –rupweb Sep 17 '15 at 8:46 For me it has been a regular issue and I follow the same approach. Actually to avoid the error it is not necessary. http://shpsoftware.com/could-not/java-error-message-could-not-find-or-load-main-class.php

Type "cd (folder name)" in the stored drive and compile it. 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 And that is a better solution in your case. –Stephen C Aug 22 '15 at 10:15 add a comment| up vote 4 down vote Sometimes what might be causing the issue Strange. –Husam Jun 24 '14 at 9:29 1 Yup.

Error Could Not Find Or Load Main Class Eclipse Java

let's go to the parent directory "C:\Users\WINDOWS 8\workspace\Demo\target\classes" and execute the same command, this time, it should work: C:\Users\WINDOWS 8\workspace\Demo\target\classes\dto>cd .. Also, as mentioned before, remember to call the full qualified name (i.e. If it helps and people upvote, what's the problem? –takendarkk Jul 17 at 20:39 2 I didn't know answers would change order based on edits - mine always rank by Then I have deleted the .class files.

Mine Stupid mistake of package name. –Mohit Jan 16 at 15:24 add a comment| up vote 47 down vote You can try these two when you are getting the error: 'could Thanks! –Tung Oct 14 at 14:19 add a comment| up vote 30 down vote I believe you need to add the current directory to the Java classpath java -cp .:./apache-log4j-1.2.16/log4j-1.2.16.jar:./vensim.jar SpatialModel It covers the first point pretty well. Error: Could Not Find Or Load Main Class Scala You just saved me from banging my head against the wall!

I removed old class that I renamed and left the class that had the new name and it compiled and ran just fine. Error: Could Not Find Or Load Main Class Jar move the whole project folder from workspace to a safe location restart eclipse (your IDE) now import your project directory from the safe location. I have set the path as suggested and now I compile the program by simply typing javac .java Mr. Is it possible to keep publishing under my professional (maiden) name, different from my married legal name?

Back to top #13 JustMike JustMike Newbie Members 33 posts Gender:Male Location:Bucharest, Romania Interests:PHP, SQL, Java, C++, HTML5, CSS3, JavaScript, laravel Posted 28 October 2013 - 06:36 PM The path and Could Not Find Or Load Main Class Maven Kiran Gowle 15.363 προβολές 6:55 How to fix Mineshafter error could not find or load main class info.mineshafter.gamestarter - Διάρκεια: 4:54. If your .class file is present in the subfolders say C:/MyClasses/com/mypackage/HelloWorld.class and com and mypackage are the packages in which the HelloWorld is present. java class main share|improve this question edited May 18 '14 at 17:34 gturri 4,79451937 asked Aug 7 '13 at 3:02 Stephen C 389k45414740 4 Please note that this is a

Error: Could Not Find Or Load Main Class Jar

include package). Saptaparna Dhar Greenhorn Posts: 10 posted 5 years ago Thank you once again Mr.John. Error Could Not Find Or Load Main Class Eclipse Java Simpson 231219 If you used an IDE or a Java build tool you most likely would not get into this problem The compiler would (or at least ... Error: Could Not Find Or Load Main Class Linux share|improve this answer answered May 21 '14 at 11:06 panoet 1,038514 See Example #2 in my answer –Stephen C Mar 6 '15 at 7:22 14 This is one

Unless you know that you are using the default classpath (or a classpath with "." on it), "cd" will have no effect. http://shpsoftware.com/could-not/java-error-could-not-find-main-class-eclipse.php I had a problem where Eclipse threw that error because I had manually deleted some *.class files. Yes, it works in many cases, but it won't in others. –Stephen C Aug 22 '15 at 6:20 @StephenC, It worked for me, and any other solution did not The java command was not able to find the class. Error: Could Not Find Or Load Main Class Netbeans

I spent hours to find a solution for this error. share|improve this answer answered Aug 22 at 15:51 Tiyeb Bellal 375219 add a comment| up vote 0 down vote Try -Xdiag. Want to make things right, don't know with whom Is foreign stock considered more risky than local stock and why? my review here This concludes this test of our sanity -- we will now return to our regular programming.

SQL Server Memory allocation and max server memory setting What is the 'dot space filename' command doing in bash? "I am finished" vs "I have finished" What are the legal consequences Error Could Not Find Or Load Main Class Spring Boot You could try installing the Netbeans IDE in the hope that it might detect and correct whatever is wrong.It could be a problem with something like the classpath, which I don't The Java Tutorial - PATH and CLASSPATH So ...

John, the output which I got by typing java in the command prompt is-- Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute

C:\Users\WINDOWS 8\workspace\Demo\target\classes>java dto.HelloHP My first program in Java, HelloWorld !! Our program runs perfectly if you just double click on it, but it doesn't as a scheduled task. Campbell Ritchie Sheriff Posts: 50568 82 posted 3 years ago hamza mohamed ansari, Your post was moved to a new topic. Error: Could Not Find Or Load Main Class Mac In the Classpath tab, I clicked "User Entries", then Advanced, then Add External Folder, then I browsed to the bin folder for my project and added it. –emery Dec 16 '13

I spent 15 minutes debugging mine only to realize I had put the class in its folder but not put the package declaration in the file. pls help. If it was there before you started, eg containing QuickTime entries, add a . http://shpsoftware.com/could-not/java-error-could-not-find-the-main-class.php I like the second option because it's easier to control and change.

Instead, I use -cp or -classpath option with java command to run my program. Here is corresponding MAC command : java -classpath ".:./lib/*" com.test.MyClass where in this example the package is com.test and a lib folder is also to be included on classpath. Posted 24 October 2013 - 10:40 PM Did you compile successfully? Had to change the lines in .classpath from to share|improve this answer

is on the classpath in my answer, which is the current directory) is pretty much because that's what was decided long ago, and we're stuck with it. –aliteralmind Nov 30 '15 share|improve this answer answered Jan 14 '15 at 13:57 JohnMerlino 1,80043567 add a comment| up vote 2 down vote If you're getting this error and you are using Maven to build Hello Javier, by scheduled task do you mean running your Java program as windows service? because Java is still looking into the current directory and there is no .\target\dto\HelloHP.class there, as it's one level down e.g. .\target\classes\dto\HelloHP.class Now let's run the same command using -classpath option

If you are still not able to fix your problem then post a comment there with what you have tried and we will try to troubleshoot together. Classes are located in the directory structure beneath that root, by mapping the fully qualified name to a pathname. The fact that it's received more than 25,000 views is an indication that many people suffer from this problem. How to create a company culture that cares about information security?

Thank you so, so much for the thorough explanation. Also you can set it "one time" with set CLASSPATH=%CLASSPATH%;. So I ended up with something like mypackage.morepackage.myclass and a directory structure looking like src/mypackage/morepackage/myclass, which inherently has nothing wrong.

© Copyright 2017 shpsoftware.com. All rights reserved.