exception java.lang....

  • Follow


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
0
Reply Reddikishore 2/27/2008 1:49:13 PM

Everything seems to be fine! you need to type/re-run properly.
0
Reply Pushkaraj 2/27/2008 2:17:31 PM


On Feb 27, 1:49 pm, Reddikishore <yourkish...@gmail.com> wrote:
> 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...
0
Reply GArlington 2/27/2008 2:23:51 PM

Reddikishore <yourkish...@gmail.com> wrote:
>>       i [sic] am getting exception :"java.langnosuchmethod:main"

GArlington wrote:
> This is NOT what you are getting...
> If there is a problem copy it as it is, DO NOT rephrase...

Amen.

>> i saved it in d:colon &

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

>> i compiled it  d:\>javac Helo.java
>>                     D:\>java Helo

you show no indication that you put the file in the "colon" directory.

>>                at this time i got this exception.in my system ihave
>> classpath&path.for this i used JDK1.6 used
>> please solve

GArlington wrote:
> 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.

-- 
Lew
0
Reply Lew 2/27/2008 2:49:42 PM

On Feb 27, 6:49 pm, Reddikishore <yourkish...@gmail.com> wrote:
> 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)
0
Reply Sreenivas 2/28/2008 2:59:36 AM

4 Replies
92 Views

(page loaded in 0.107 seconds)

Similiar Articles:













7/26/2012 6:32:57 PM


Reply: