#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    Holland
    Posts
    0
    Rep Power
    0

    Question error compiling java in Windows XP?


    Hello,

    Im trying java for the first time. When i compile a simple "hello"
    programm i get the following message:

    Exception in thread "main" java.lang.NoClassDefFoundError:
    com/sun/tools/javac/Main

    This is my "hello" programm:

    import java.awt.*;
    import java.applet.Applet;

    public class Greeting extends Applet {
    public void paint (Graphics g) {
    g.drawString ("hello", 50, 50);
    }
    }

    Is it a WindowsXP problem?
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    538
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    wieringerwerf, netherlands
    Posts
    0
    Rep Power
    0
    dat probleem heb ik ook

    enig idee hoe ik dat oplos??
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    wieringerwerf, netherlands
    Posts
    0
    Rep Power
    0
    sorry..

    english

    i got the same problem

    how do I solve that?
  8. #5
  9. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    From a Sun web page:
    Error Explanation
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp

    If you receive this error, java cannot find your bytecode file, HelloWorldApp.class.

    One of the places java tries to find your bytecode file is your current directory. So, if your bytecode file is in C:\java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Enter:

    cd c:\java
    The prompt should change to C:\java>. If you enter dir at the prompt, you should see your .java and .class files. Now enter java HelloWorldApp again.
    If you still have problems, you might have to change your CLASSPATH variable. To see if this is necessary, try "clobbering" the classpath with the following command:

    set CLASSPATH=
    Now enter java HelloWorldApp again. If the program works now, you'll have to change your CLASSPATH variable. For more information, consult the section 5. Update the PATH variable in the installation instructions.

    ---------------------------------------

    And here is another link I found
    http://www.cas.mcmaster.ca/~lis3/jav.../Classpath.htm
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    0
    Rep Power
    0
    mmmhhh..... this is an example of an error occured whenyou try to running an applet as an applicaion.
    you have this error when use:

    javac Greeting.java

    or when you type:

    java Greeting

    ?????

    (sorry for my bad english, i'm italian ^_^)

IMN logo majestic logo threadwatch logo seochat tools logo