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
for some reason it's not letting me run itCode:class fun { public static void main(String[] arguments) { // My first Java program goes here String greeting = "Hello World"; System.out.println(greeting); } }
after i installed the kit
in dos i write
java -version
and it gave me
so i know that it can find the jdk1.3 folderjava 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 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
i then looked in the appendix and tried to add this line to my autoexc.bat file (i have win 98)
C:\jdk1.3\bin>java c:\javafile\fun
Exception in thread "main" java.lang.NoClassDefFoundError: c:\javafile\fun
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





Reply With Quote