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 9 of 9

Thread: Error: Could not find or load main class

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Error: Could not find or load main class

    Error: Could not find or load main class

    What is this? Maybe some error with classpath or path?


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: Error: Could not find or load main class

    Classpath.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Error: Could not find or load main class

    It seems it is not that.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Error: Could not find or load main class

    Can you post the full contents of the command prompt window that shows the command that was entered and the error message?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Mar 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Error: Could not find or load main class

    This is directory:
    C:\Users\Lazar\Documents\NetBeansProjects\hello\sr c\hello\Hello.class

    and this is my command and error:

    C:\Users\Lazar\Documents\NetBeansProjects\hello\sr c\hello>java Hello.class
    Error: Could not find or load main class

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Error: Could not find or load main class

    The java command takes a classname for its arg, not a filename. Leave off the .class

    Did you copy the full contents of the command prompt window
    or type in manually what was posted in post#5?

    The error message is missing some text.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Mar 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Error: Could not find or load main class

    It is ok now! Thank you for help

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Error: Could not find or load main class

    Also posted at: Error: Could not find or load main class - Dev Shed

    Looks like OP didn't say that the class was in a package.
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Mar 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Error: Could not find or load main class

    I finished my FTP Client application!!!!!!!!
    THANKS NORM!! I keep runing into you everywhere.
    You will find this post on some more places!!!!

Similar Threads

  1. Can't find Main Class??
    By zlloyd1 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 12th, 2013, 01:38 PM
  2. Execution of .jar file: Could not find main class....Error'
    By suyog53 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: October 14th, 2012, 02:04 PM
  3. Replies: 4
    Last Post: September 3rd, 2012, 02:47 AM
  4. newbie question: Error: Could not find or load main class Java Result: 1
    By ideaman in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 1st, 2012, 11:40 PM
  5. could not find the main class
    By Tisofa in forum Object Oriented Programming
    Replies: 1
    Last Post: September 27th, 2009, 02:58 AM