Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Very New Programmer - NoClassDefFoundError - How Can I Fix My Problem?

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Very New Programmer - NoClassDefFoundError - How Can I Fix My Problem?

    I was so intrigued by the Java language that I wanted to learn the language, pretty simple. So, I followed this guys tutorial and it was very nice and up to the point where you have to run the java file I get an error.

    This is the link to the tutorial followed:
    http://www.youtube.com/watch?v=5u8rFbpdvds&feature=fvwrel


    Here is what is in the oranges.java in the Test folder in the C drive.
    class oranges{
    	public static void main(String args[]){
    		System.out.println("Hello Youtube");
    	}	
    }

    This is the error I receive:


    Please remember that this is the first time I've EVER attempted to try to learn Java and I know there will be humps in the way but that's why I am here! Thanks guys!


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: Very New Programmer - NoClassDefFoundError - How Can I Fix My Problem?

    Have you first tried compiling the code by calling javac oranges.java?

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Very New Programmer - NoClassDefFoundError - How Can I Fix My Problem?

    Quote Originally Posted by curmudgeon View Post
    Have you first tried compiling the code by calling javac oranges.java?
    Yes sir I have. I have oranges.class in my Test folder in my C: drive.

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: Very New Programmer - NoClassDefFoundError - How Can I Fix My Problem?

    Try stating the classpath when you run the program, something like:

    java -cp . oranges

    (note the period between -cp and oranges as it is very important)

  5. The Following User Says Thank You to curmudgeon For This Useful Post:

    Tharlew (November 22nd, 2012)

  6. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Very New Programmer - NoClassDefFoundError - How Can I Fix My Problem?

    Quote Originally Posted by curmudgeon View Post
    Try stating the classpath when you run the program, something like:

    java -cp . oranges

    (note the period between -cp and oranges as it is very important)
    You're brilliant! Thanks a lot.

  7. The Following User Says Thank You to Tharlew For This Useful Post:

    LittleCat (November 23rd, 2012)

  8. #6
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: Very New Programmer - NoClassDefFoundError - How Can I Fix My Problem?

    You're welcome!

Similar Threads

  1. Replies: 1
    Last Post: June 9th, 2012, 12:29 PM
  2. could anybody fix my problem? resultset is closed
    By kagami in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 18th, 2012, 09:18 AM
  3. Little easy to fix problem
    By adammint7 in forum Java Theory & Questions
    Replies: 9
    Last Post: April 14th, 2011, 11:07 AM
  4. Need Help i cant fix this problem ...
    By mico332 in forum Member Introductions
    Replies: 3
    Last Post: March 18th, 2011, 07:12 PM
  5. [SOLVED] looping problem in Hailstrom program
    By JonnyBoy in forum Algorithms & Recursion
    Replies: 5
    Last Post: May 9th, 2009, 01:58 AM