exception java.lang....

Discussion in 'Java' started by Reddikishore, Feb 27, 2008.

  1. Reddikishore

    Reddikishore Guest

    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
    Reddikishore, Feb 27, 2008
    #1
    1. Advertising

  2. Reddikishore

    Pushkaraj Guest

    Everything seems to be fine! you need to type/re-run properly.
    Pushkaraj, Feb 27, 2008
    #2
    1. Advertising

  3. Reddikishore

    GArlington Guest

    On Feb 27, 1:49 pm, Reddikishore <> 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...
    GArlington, Feb 27, 2008
    #3
  4. Reddikishore

    Lew Guest

    Reddikishore <> 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
    Lew, Feb 27, 2008
    #4
  5. Reddikishore

    Sreenivas Guest

    On Feb 27, 6:49 pm, Reddikishore <> 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)
    Sreenivas, Feb 28, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page