Link to home
Start Free TrialLog in
Avatar of PeterFrb
PeterFrbFlag for United States of America

asked on

Message "Error: Could not find or load main class Sample" when running Java program

I am fairly new to Java, and I am following the tutorial from the following site:
     https://www.youtube.com/watch?v=svJQu6LUSTs

I have successfully installed Java,  the JDK, and Ecclipse Indigo.  All of the programs have the same look and feel as they do on the tutorial, so I know the installations have been done correctly.  As per instructed, I have created a sample class, and everything looks like it does in the tutorial.  The problem comes at the end, when I run the program, and I get the message: "Error: Could not find or load main class Sample".  Everything else seems to be as instructed, and I am new enough to this that I can not figure out where to resolve the problem.  I have included a screen shot.  Any assistance would be appreciated.  Thank you, ~ Peter Ferber

User generated image
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I am fairly new to Java
In that case, i would not use Eclipse nor any other IDE.

What you're learning now is not Java but Eclipse. There is nothing wrong with the code.

My guess is that you haven't set the main class properly in the project properties
ASKER CERTIFIED SOLUTION
Avatar of PeterFrb
PeterFrb
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, i should have enlarged the image. The class appears to have compilation errors that are not due to errors in the code shown. But ... that's a problem that's much less likely to occur were you to be compiling at the command line. The IDE hides stuff from you
Avatar of PeterFrb

ASKER

My own research and followup were responsible for finding and resolving the problem.