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

Jennifer Barbee
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Barbee
Front End Web Development Techdegree Student 2,387 Points

Why can my main method not be found already ?

I'm trying to begin my first project but already have an error and I don't understand why it's there. I tried to test the instructions for the project by cd src/main/java and then run a practice line of code to see if it is working properly. However, I'm getting a message that my main class can't be loaded. What am I doing wrong?? I just started it!

Code: public class GuessingGame { public static void main(String[] args) { System.out.println("hi");

}

}

Error: Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
Error: Could not find or load main class GuessingGame.java
treehouse:~/workspace/src/main/java$

1 Answer

Jennifer Barbee
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Barbee
Front End Web Development Techdegree Student 2,387 Points

Disregard. The 'before you start instructions' had an error saying to: clear && javac GuessingGame.java && java GuessingGame.java

I changed it to: clear && javac GuessingGame.java && java GuessingGame (taking .java off the second one as we learned) and it works fine :)