Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects (Retired) Meet Objects Creating Classes

Rony Gan
Rony Gan
829 Points

Getting Error:

Error: Could not find or load main class Example.java while running the program

Can you list your code here for each class?

As Philip stated we will need the code for your classes since it could be a number of issues. The most likely is that you made a typo somewhere, like misspelling Example at some point or some other small error like that.

Sounds like you deleted a file of didn't link the methods to communicate with the main java file.

John Paige
John Paige
7,436 Points

I had the same issue a few minutes ago. I spell-checked both classes and then spell checked what i typed in the console, to realize i put "clear %% javac Example.java && java Example" I changed it and it worked.

Show us the code by updating your problem, then I'll try to figure, what's wrong.