Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2007

Tip: Looking for answers? Try searching our database.

Learning JAVA need help

Thread view: 
BlackJackal - 03 Jan 2007 05:16 GMT
Alright this is a code example straight from the first chapter of the
text book I am learning from and I can't get it to compile I receive
the error message NoClassDefFoundError.  Please tell me what is wrong.

public class First
{
    public static void main(String[] args)
    {
    System.out.println("First Java Application");
    }
}

The file is named First.java.  Thx in advance!!!!
Andrew Thompson - 03 Jan 2007 05:26 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.