Welcome to Dream.In.Code
Become a Java Expert!

Join 149,523 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,409 people online right now. Registration is fast and FREE... Join Now!




unexpected error

 
Reply to this topicStart new topic

unexpected error

felisberto
4 Jul, 2007 - 02:29 PM
Post #1

New D.I.C Head
*

Joined: 4 Jul, 2007
Posts: 12


My Contributions
i'm java beginner .trying to write my first java program with drjava IDE
CODE

public class Assignment01
{
public static void main(String[] args)
{
  System.out.println("My name is Trevor");
  System.out.println("I am 17 years old");
  System.out.println("My favorite sports are Skiing and Ping-Pong.");
}
}


but when i compile got the unexpected error

File: (no associated file) [line: (no source location)]
Error: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/Context

what to do?what it means?
User is offlineProfile CardPM
+Quote Post

PennyBoki
RE: Unexpected Error
4 Jul, 2007 - 02:39 PM
Post #2

system("revolution");
Group Icon

Joined: 11 Dec, 2006
Posts: 2,010



Thanked: 7 times
Dream Kudos: 500
Expert In: Java,C++,C

My Contributions
Hi, I don't think that there is an error in your code, what kind of OS do you use? I never used drjava IDE so can't tell much there, but since you are a beginner in Java I highly recommend that you use JCreator which is free and very easy to use. You can download it HERE.

P.S. I even compiled your code in JCreator and it does work.

This post has been edited by PennyBoki: 4 Jul, 2007 - 02:41 PM
User is offlineProfile CardPM
+Quote Post

felisberto
RE: Unexpected Error
4 Jul, 2007 - 03:41 PM
Post #3

New D.I.C Head
*

Joined: 4 Jul, 2007
Posts: 12


My Contributions
QUOTE(PennyBoki @ 4 Jul, 2007 - 03:39 PM) *

Hi, I don't think that there is an error in your code, what kind of OS do you use? I never used drjava IDE so can't tell much there, but since you are a beginner in Java I highly recommend that you use JCreator which is free and very easy to use. You can download it HERE.

P.S. I even compiled your code in JCreator and it does work.


my OS is windows XP.I''LL TRY Jcreator.do i have to download JDK first?

User is offlineProfile CardPM
+Quote Post

Jayman
RE: Unexpected Error
4 Jul, 2007 - 05:28 PM
Post #4

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,303



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Did you name the file exactly the same as the name of the class?

File name should be Assignment01.java.
User is offlineProfile CardPM
+Quote Post

Programmist
RE: Unexpected Error
5 Jul, 2007 - 02:03 AM
Post #5

Four-letter word
Group Icon

Joined: 2 Jan, 2006
Posts: 1,250



Thanked: 11 times
Dream Kudos: 100
Expert In: Java

My Contributions
I agree that this is a problem with you IDE (Dr Java). java.lang.NoClassDefFoundError usually means that Java can't find the file you are trying to run. In this case it is having trouble with com.sun.tools.javac.util.Context, which is not your class, so my guess is that your IDE is messed up.

Now, I hear that JCreator is easier for beginners, but if software development is an integral part of your major, I would recommend trying Eclipse (or NetBeans) at some point. It is free, and has many many tools that the free version of JCreator does not have. For instance, you have to buy the Pro version of JCreator to get a debugger, but Eclipse comes standard with that. You may not care about a debugger now, but the sooner you use to learn one, the better off you'll be. I see questions on this forum all the time that the author could quickly solve if they knew how to use a debugger. Maybe not today, but soon...I'd look at it.
User is offlineProfile CardPM
+Quote Post

felisberto
RE: Unexpected Error
6 Jul, 2007 - 01:35 PM
Post #6

New D.I.C Head
*

Joined: 4 Jul, 2007
Posts: 12


My Contributions
QUOTE(alcdotcom @ 5 Jul, 2007 - 03:03 AM) *

I agree that this is a problem with you IDE (Dr Java). java.lang.NoClassDefFoundError usually means that Java can't find the file you are trying to run. In this case it is having trouble with com.sun.tools.javac.util.Context, which is not your class, so my guess is that your IDE is messed up.

Now, I hear that JCreator is easier for beginners, but if software development is an integral part of your major, I would recommend trying Eclipse (or NetBeans) at some point. It is free, and has many many tools that the free version of JCreator does not have. For instance, you have to buy the Pro version of JCreator to get a debugger, but Eclipse comes standard with that. You may not care about a debugger now, but the sooner you use to learn one, the better off you'll be. I see questions on this forum all the time that the author could quickly solve if they knew how to use a debugger. Maybe not today, but soon...I'd look at it.


i thought was about jdk installation as the path was not settled propely but
i don''t think so .
great advice i''ll try netbeans. thanks tongue.gif

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 08:37PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month