help with JAVA

Discussion in 'QnA (read only)' started by cockyrudh_2020, Sep 8, 2004.

Thread Status:
Not open for further replies.
  1. cockyrudh_2020

    cockyrudh_2020 New Member

    Joined:
    Mar 7, 2004
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    hyderabad
    hey u guys,
    im in a fix,m i got this problem with java..
    Whenver i try to run a progrm, i get an error saying "NoClassDefFoundError", although the program is compiled well!!!

    Plz help me, im running windows XP, java was runnning well before on XP, i lately am experiencing this problem,.....
     
  2. pradeep_chauhan

    pradeep_chauhan New Member

    Joined:
    Aug 16, 2004
    Messages:
    1,150
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    New Delhi
    add a variable called CLASSPATH in your local variables indicating the location of your class file and also the jre/jdk class files.
     
  3. #/bin/sh

    #/bin/sh New Member

    Joined:
    Apr 20, 2004
    Messages:
    213
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    42.65 N 73.76 W
    means that your classpath is not set correctly. Make sure your JAVA_HOME is set up right before you run the startup scripts.
     
  4. #/bin/sh

    #/bin/sh New Member

    Joined:
    Apr 20, 2004
    Messages:
    213
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    42.65 N 73.76 W
    post you're source code,
    it will help to solve you're problem & and let me know what you doing with?
     
  5. GNUrag

    GNUrag FooBar Guy

    Joined:
    Jun 22, 2004
    Messages:
    1,246
    Likes Received:
    5
    Trophy Points:
    0
    Location:
    Interwebs
    for UNIX:
    add this to your /etc/profile

    CLASSPATH=/usr/jdk/jre/lib/rt.jar:.
    export CLASSPATH


    for WinXP,
    add the path to your CLASSPATH environment variable.
    CLASSPATH=C:\jdk\jre\lib\rt.jar;.


    Notice the dot in the end... it refers to the class file that is in ur current directory...
     
  6. OP
    OP
    cockyrudh_2020

    cockyrudh_2020 New Member

    Joined:
    Mar 7, 2004
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    hyderabad
    well i tried everything you guys suggested, but of no use

    my java folder is in D:/java
    bin is in D:/java/bin

    all my programs which used to compile earlier no longer work! im in a fix plz helpme
    ---ANIRUDH
     
  7. #/bin/sh

    #/bin/sh New Member

    Joined:
    Apr 20, 2004
    Messages:
    213
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    42.65 N 73.76 W
    If you can't compile, your PATH probably needs to be set.

    c:/>set PATH=%PATH%;d:/java/bin

    You can permanently set this by going to (WinXP) Start>Settings>System, Advanced tab, Environmental Variables
    What do you get if you type in
    java - version

    If your system can't find this, it is a path problem. You can either set the path, or make it explicit:
    d:/java/bin/javac MyClass.java //to compile
    d:/java/bin/java -cp . MyClass //to run
     
  8. OP
    OP
    cockyrudh_2020

    cockyrudh_2020 New Member

    Joined:
    Mar 7, 2004
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    hyderabad
    well i managed to mess around and get it working,.... thanx for all the help guys!!!
    --Anirudh
     
  9. #/bin/sh

    #/bin/sh New Member

    Joined:
    Apr 20, 2004
    Messages:
    213
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    42.65 N 73.76 W
    can you please post the full error stack you got?
    with source code.
     
  10. #/bin/sh

    #/bin/sh New Member

    Joined:
    Apr 20, 2004
    Messages:
    213
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    42.65 N 73.76 W
    welcome no problem.
     
Thread Status:
Not open for further replies.

Share This Page