exception java.lang....

R

Reddikishore

Helo sirs
i am getting exception :"java.langnosuchmethod:main"
when i run simple follwing program
class Helo
{
public static void main(String args[])
{
System.out.println("Hello");
}
}
i saved it in d:colon &
i compiled it d:\>javac Helo.java
D:\>java Helo
at this time i got this exception.in my system ihave
classpath&path.for this i used JDK1.6 used
please solve
 
G

GArlington

Helo sirs
i am getting exception :"java.langnosuchmethod:main"

This is NOT what you are getting...
If there is a problem copy it as it is, DO NOT rephrase...
when i run simple follwing program
class Helo
{
public static void main(String args[])
{
System.out.println("Hello");
}}

i saved it in d:colon &
i compiled it d:\>javac Helo.java
D:\>java Helo
at this time i got this exception.in my system ihave
classpath&path.for this i used JDK1.6 used
please solve

if java.lang.NoSuchMethodException is thrown that means JVM can not
find your class/method...
Check your class path...
 
L

Lew

Reddikishore said:
i [sic] am getting exception :"java.langnosuchmethod:main"
This is NOT what you are getting...
If there is a problem copy it as it is, DO NOT rephrase...
Amen.

In what directory did you place the source file? Because in your command lines:

you show no indication that you put the file in the "colon" directory.
if java.lang.NoSuchMethodException is thrown that means JVM can not
find your class/method...
Check your class path...

Also, list your working directory (D:\ in the example you gave) to make sure
the .java and .class files that you expect actually are there.

The default classpath absent explicit specification is '.', the current
working directory. Your commands should have worked, if the .java and .class
files were in the correct directory.

For future reference, don't use the root directory of a drive as your working
directory.
 
S

Sreenivas

Helo sirs
i am getting exception :"java.langnosuchmethod:main"
when i run simple follwing program
class Helo
{
public static void main(String args[])
{
System.out.println("Hello");
}}

i saved it in d:colon &
i compiled it d:\>javac Helo.java
D:\>java Helo
at this time i got this exception.in my system ihave
classpath&path.for this i used JDK1.6 used
please solve

As far as i know,this exception occurs in two ways.The first one is if
you doesn't set CLASSPATH environment variable.
second one is if you doesn't write the main method signature as
main(String [] args) or main(String args [])or main(String...args)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top