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 Data Structures - Retired Getting There Class Review

Jun Dong
Jun Dong
4,754 Points

Cannot find or load main class Example

When I try to run the program it says cannot find or load main class Example here's my code:

package com.teamtreehouse;

import com.teamtreehouse.Treet;

import java.util.Date;

public class Example {

  public static void main(String[] args) {
    Treet treet = new Treet("craigsdennis", "Want to be famous? Simply tweet about " +
   "java and use the hashtag #treet. I’ll use your tweet in a new @treehouse course" +
   " about data structures.",
   new Date(1421849732000L));
    System.out.printf("This is a new Treet:   %s %n", treet);
  }

}
Naval Kulkarni
Naval Kulkarni
13,782 Points

Are you Running the program in an IDE?

if you are, then you need to edit your configurations for the project to reflect that your main method is in Example Class.

Jun Dong
Jun Dong
4,754 Points

Oh it worked after deleted

package com.teamtreehouse;
Sean M
Sean M
7,344 Points

Edit to response: Never mind, I see you figured it out which is good!

2 Answers

Did you save your program, and do:

javac Example.java && java Example

Jun Dong
Jun Dong
4,754 Points

yes but it still won't run

Sean M
Sean M
7,344 Points

Edit to response: Never mind, I see you figured it out which is good!