Results 1 to 5 of 5

Thread: Exception in thread main{resolved}

  1. #1

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Exception in thread main{resolved}

    This is the error message I get after I compile and then try to run a simple hello world program.
    Theres nothing wrong with the syntax.
    Heres the error message I get:
    Exception in thread "main" java.lang.NoClassDefFoundError: hello

    The way I can get this to work is type in the command prompt:
    Set CLASSPATH=
    and then im able to run the program and it works.(only thing wrong with this is it's temporary)


    Here is some info if you need it:

    These are my Environment Variables:

    Classpath
    C:\Sun\AppServer\jdk\lib\tools.jar\ext

    Path
    C:\Sun\AppServer\jdk\bin


    java version 1.4.2_04
    java 2 runtime environment, standard edition

    Please help me. I have looked everywhere for answers and sources say I have'nt done anything wrong but obviously something is.
    Last edited by System_Error; Jun 10th, 2004 at 10:16 AM.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It means it can't find the class you're specifying on the command line.

    You can amend that by emptying the classpath (as you did, this causes the JVM to look in the current directory) or by adjusting it to include ".", the current directory.

    java -cp "%CLASSPATH%;." hello
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111
    Thanks for the help, but is there not a way to permanantly set the Classpath?

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Somewhere in the control panel...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    I just usualy run using C:\> java -classpath C:\path; app unless i set my class path in the system configuration editor.

Posting Permissions

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



Click Here to Expand Forum to Full Width