954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error running Java

I was executing a simple core java application using JDK1.5

I wrote code and complied using javac it gave some errors that i fixed and at last it got complied successfully But when i tried to exeute it using java it gave me an error message

Error in thread main.NoSuchMethodFound error:main

Ok now i wanna know why i got this error message , i tried to place the java file in Bin folder and eecute it from there but it didnt worked out.


Can anybody explain me waht to do in such case and how to egt rid of this problem

staneja
Junior Poster in Training
64 posts since Dec 2006
Reputation Points: 10
Solved Threads: 2
 

The error is saying that it can't find the 'main' method.

Did you try to run the '.Java' file?

try to run it without the extension

E.g.

java HelloWorld

instead of

java HelloWorld.java

Cerberus
Junior Poster
162 posts since Sep 2006
Reputation Points: 27
Solved Threads: 14
 

First of all, never place anyting into the "bin" directory of jdk (or really in any directory of the jdk/jre).

Second of all, does your class contain the following method defintion:

public static void main(String[] args) {
  // your code here
}

and I mean that exact method definition? Bcause the error you listed, says it does not.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

Well I would like to say thanks

I was getting this error because i forgot to put array brackets after args

I mean instead of String args[] i had written String args

so the problem is solved now

staneja
Junior Poster in Training
64 posts since Dec 2006
Reputation Points: 10
Solved Threads: 2
 

Staneja if your problem gets solved means just mark it as solved.

vinod_javas
Practically a Posting Shark
871 posts since Feb 2007
Reputation Points: 119
Solved Threads: 7
 

Can you please tell me how to mark it solved.

I didnt find any option to do so

staneja
Junior Poster in Training
64 posts since Dec 2006
Reputation Points: 10
Solved Threads: 2
 

Mark as Solved | Show Printable Version | Email this Page | Unsubscribe from this Thread


can You see this ... just see above ur first post
and click that link Mark as Solved

ok

vinod_javas
Practically a Posting Shark
871 posts since Feb 2007
Reputation Points: 119
Solved Threads: 7
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You