java problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • purujitb
    New Member
    • May 2006
    • 1

    java problem

    WHENEVER I TRY TO RUN A JAVA PROGRAM I GET THE FOLL MESSAGE:

    Exception in thread "main" java.lang.NoCla ssDefFoundError : A

    BUT THE COMPILATION IS OK.

    PLEASE HELP.
  • darine32
    New Member
    • Jul 2006
    • 3

    #2
    do a save as to another location. If this does not work copy your code and create a new java file. Paste it and rename your class to the new file name.

    Comment

    • D_C
      Contributor
      • Jun 2006
      • 293

      #3
      How are you running your java program? From the command line?

      If it compiles, but can't find the class, the typical problem is that your class compiles in one direction, and you want to run your program from a different directory.

      By default, the java program assumes you have the class in the same directory. Otherwise, you need to specify it's location using the -cp (directory of class here) switch. Also, be sure not to put .java at the end of the class name.

      Comment

      • Devendra
        New Member
        • Aug 2006
        • 12

        #4
        I think u do not set class path properly
        when u compile a file it must be in the same directory but u can run it anywhere

        set path and classpath in invironment vriable as
        go start-> control panel->system->advanced->environment variables->

        path
        .;%path%;c:/jdk1.4/bin;

        classpath
        .;%classpath%;c :/jdk1.4/lib;

        Comment

        Working...