Exception in thread "main" java.lang.NoClassDefFoundError:
hello all,
i am starting a introductory java course next week and thought it would be nice to at least try to write-compile-run a simple java program.
here is my code
Code:
class fun {
public static void main(String[] arguments) {
// My first Java program goes here
String greeting = "Hello World";
System.out.println(greeting);
}
}
for some reason it's not letting me run it
after i installed the kit
in dos i write
java -version
and it gave me
Quote:
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
so i know that it can find the jdk1.3 folder
so i went to the bin folder and compiled the above program
javac c:\javafile\fun.java
it worked since i had no message and a file was created on the same level called fun.class
so then i tried to run it
java c:\javafile\fun
and this is the message i got
Quote:
C:\jdk1.3\bin>java c:\javafile\fun
Exception in thread "main" java.lang.NoClassDefFoundError: c:\javafile\fun
i then looked in the appendix and tried to add this line to my autoexc.bat file (i have win 98)
SET CLASSPATH=%CLASSPATH%;.;C:\jdk1.3\lib\tools.jar;c:\jdk1.3
the book said that this should fix my problem but i get still the same error :(
can anyone tell me what i should check next?
why does it let me compile but not run?
help i'm stuck..
bsw