File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes LinkHashMap problem! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "LinkHashMap problem!" Watch "LinkHashMap problem!" New topic
Author

LinkHashMap problem!

bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
Hi there!

This compiles fine, but when i go to run it, it gets the following error:

C:\antlr.xref\src\org\antlr\java\crossref>java x . > o
Exception in thread "main" java.lang.NoClassDefFoundError: java/util/LinkedHashM
ap

And if i change the LinkedHashMap to a HashMap, it runs ok!

Any insights would be appreciated!

bc

[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ July 23, 2004: Message edited by: Dirk Schreckmann ]
Dmitry Melnik
Ranch Hand

Joined: Dec 18, 2003
Posts: 328
When you run your program, does your classpath include tools.jar file ? The one that comes with JDK/JRE ? Make sure it does.
bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
Thanks Dmitry!

You are correct, it was a classpath problem!

Have a nice weekend, appreciate the help!

bc
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
You may well have had a CLASSPATH problem, but I wouldn't suspect that adding tools.jar to be the likely solution. tools.jar doesn't contain the J2SE API. It contains some tools, for doing things like compiling at runtime.

rt.jar contains the J2SE API, but it shouldn't need to be added to the CLASSPATH, as the JRE should be able to locate it automatically.

For your CLASSPATH setting, if you don't need anything not in the J2SE API, then I'd suggest either not specifying a CLASSPATH value, or simply specifying that the current working directory, represented by a period, is in your CLASSPATH.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LinkHashMap problem!