Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting up java sdk 1.4.6

Status
Not open for further replies.

NoobixCube

Programmer
Jan 21, 2008
2
0
0
Hey guys,
Just installed java with Textpad as the editor. Have a source code that was supplied but I after I compile it I get the msg:
Exception in thread "main" java.lang.NoSuchMethodError: main

Is this to do with setting up the root?
 
This is more a pure Java question more than a J2EE one. You can have a look at the classpath.

Cheers,
Dian
 
Like Diancecht said... take a look at the classpath file. But also try to see if the method main exists in the class, and see if it's well referenced.
 
the main method must have the following format:

public static void main(String[] args){
//do sth.
}

if the main method is not static, or it's not public, you'll get the error above.
 
For example your package is mycodes.MyClass

and your classes in /home/mydir/mycodes/MyClass

than you should launch as

cd /home/mydir

java mycodes.MyClass

you should not run in /home/mydir/mycodes/

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top