Sub: Learning JAVA need help
Not a particularly helpful title, but since you brought it up.
comp.lang.java.help is a good group for learners.
Also - a better title attracts the attention of people most
likely to be able to help, so it might have been useful to
include 'NoClassDefFoundError' in the title.
> Alright this is a code example straight from the first chapter of the
> text book I am learning from ...
Title being?
>...and I can't get it to compile I receive
> the error message NoClassDefFoundError.
Please copy/paste output, exactly as it appears.
> The file is named First.java.
It would be helpful to know that exact compile and
run-time commands you typed to get this error as
well, so extending the above, might end with..
<output>
D:\first>javac First.java
D:\first>java First.java
Exception in thread "main" java.lang.NoClassDefFoundError: First/java
D:\first>java First
First Java Application
D:\first>
</output>
HTH
Andrew T.
Andrew Thompson - 03 Jan 2007 05:28 GMT
...
> comp.lang.java.help is a good group for learners.
I made that comment, because I stupidly thought I
was replying to a post in a different group. My bad.
Andrew T.
BlackJackal - 03 Jan 2007 05:32 GMT
Title of the Book is Java Programming Third Edition by Joyce Farrell
Output is as follows
----jGRASP exec: javac -g C:\JAVA\First.java
java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
I also tried to run the compile from the command line using the command
javac First.java and received this output.
C:\JAVA>javac First.java
Exception in thread "main" java.lang.NoClassDefFoundError:
com/sun/tools/javac/M
ain
Andre Hinrichs - 03 Jan 2007 11:58 GMT
> Title of the Book is Java Programming Third Edition by Joyce Farrell
>
[quoted text clipped - 13 lines]
> Exception in thread "main" java.lang.NoClassDefFoundError:
> com/sun/tools/javac/Main
This is not a compiler message. It seems, that your JDK installation is
broken. The exception is thrown by the javac command and not by your
source, which means that the javac command itself cannot be run. What
does 'javac -version' show? What system are you using?
Try to reinstall the JDK. If you are not the admin, ask him to do this.
Andre