Results 1 to 5 of 5
  1. #1
    roshmahee is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default Please Help to rectify

    I just tried to run my first java program in command prompt.
    It gives the following error. Please help me to rectify.

    D:\java>java Welcome
    Exception in thread "main" java.lang.NoClassDefFoundError: Welcome
    Caused by: java.lang.ClassNotFoundException: Welcome
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)

    D:\java>

    Thank you in advance

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,967
    Rep Power
    19

    Default

    It can't find a Welcome class file in the D:\java directory.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,967
    Rep Power
    19

    Default

    Quote Originally Posted by akiravelmont View Post
    may be the class name which you given to the main() class and your save file name differ.
    Unless the OP has changed the name of the class file then that won't have happened. If the java file name was different then there'd be a compiler error.

    So posting the code will not help.

    A directory listing might.

  4. #4
    akiravelmont is offline Member
    Join Date
    Mar 2011
    Location
    bangalore
    Posts
    61
    Rep Power
    0

    Unhappy

    if we wont give public before the class it never give any compilation error.
    but shows exceptions.

    But in the exception it mention wrong class. I forgot that one. sorry

  5. #5
    roshmahee is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default Thank you

    Thank you very much for replying.

    After trying everything to rectify the code and command lines I did a virus scan.
    Found several files in java\bin directory infected.

    After disinfecting it the program works.

    What had happen was it doesn't allow to create a class file, even javac command is given correctly.

    Thank you again

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •