Could not find or load main class
I come across this occasionally, what causes it?
Re: Could not find or load main class
Quote:
Originally Posted by
kkid
I come across this occasionally, what causes it?
you must have a class that looks like the following
Code:
public static void main(String[] args){
}
this is always the method that is run after you compile your program. There are a few exceptions but from what i know. One way or another this is satisfied somewhere.
---edit---
after I compile with no main method this isn't the error I get. So sorry if this doesn't help you.
Re: Could not find or load main class
Hello.
A couple of things:
1) did you mis-type or mis-spell your class name? I always first check my spelling and look for typos
2) did you save the class is the wrong location? If you are using command prompt, be sure to navigate to the folder that holds your class.
If you give us the full error message you are getting, and more details when you get the error message, people here can better pinpoint the problem(s).
Re: Could not find or load main class
Quote:
Originally Posted by
killutch
you must have a class that looks like the following
Code:
public static void main(String[] args){
}
this is always the method that is run after you compile your program. There are a few exceptions but from what i know. One way or another this is satisfied somewhere.
---edit---
after I compile with no main method this isn't the error I get. So sorry if this doesn't help you.
isn't that a method, not a class?
Quote:
Originally Posted by
Humphrey Bogart
Hello.
A couple of things:
1) did you mis-type or mis-spell your class name? I always first check my spelling and look for typos
2) did you save the class is the wrong location? If you are using command prompt, be sure to navigate to the folder that holds your class.
If you give us the full error message you are getting, and more details when you get the error message, people here can better pinpoint the problem(s).
What do you mean misspelling the class name? I thought I could call it anything.
Re: Could not find or load main class
Remember that Java is case sensitive. If you place a class hello inside a file called Hello.java (which is perfectly legal) and try to run "java Hello" you will get that message as Hello.java does not have a main method.