Results 1 to 4 of 4
  1. #1
    cornelombaard is offline Member
    Join Date
    Feb 2014
    Posts
    2
    Rep Power
    0

    Default Cannot find or load or find main class

    This is my very first day of learning Java. I am using Netbeans as my IDE and I have created a program called Saluton.java

    I navigate to the folder holding the class file using the command line under Windows 7 but when I issue the command java Saluton.class I get an error it cannot load or find the main class. So how does that work please?

    Any help is greatly appreciated

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Cannot find or load or find main class

    Leave the .class extension off when using the java command.

    Note: When posting error messages, please copy the full text and paste it here so we can see it exactly.
    D:\JavaDevelopment\Testing\ForumQuestions10>java Test.class
    Error: Could not find or load main class Test.class

    D:\JavaDevelopment\Testing\ForumQuestions10>
    Note: the name of the class that was not found is in the error message
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    cornelombaard is offline Member
    Join Date
    Feb 2014
    Posts
    2
    Rep Power
    0

    Default Re: Cannot find or load or find main class

    Thank you it works. I will remember to include the whole message next time Sorry

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Cannot find or load or find main class

    I hope you will now be curious as to WHY it works like this and go read into that.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. could not find or load main class HelloWorldExample
    By tedjava in forum New To Java
    Replies: 5
    Last Post: 12-10-2012, 05:45 AM
  2. Could not find or load main class
    By kkid in forum New To Java
    Replies: 4
    Last Post: 10-15-2012, 04:47 AM
  3. Error: could not find or load main class
    By sloppygecko in forum New To Java
    Replies: 3
    Last Post: 08-08-2012, 03:11 PM
  4. Error: Could not find or load main class
    By Tybald in forum Eclipse
    Replies: 5
    Last Post: 05-28-2012, 11:22 AM
  5. Replies: 3
    Last Post: 12-09-2011, 03:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •