Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eclipse - java.lang.NoClassDefFoundError: com/sleepycat/je/DatabaseException



Greg Guerin wrote:
How do you know Eclipse loaded the imported classes to compile them?

Eclipse would give errors (show a red underline on the imports and/or class names) while editing the files and when saving them, which is when it compiles code - so you'd know for sure if it didn't have the imported classes.


If your project is built using a different build tool, it probably still runs 'javac' at some point, so the default for 'javac' would be the same.

Assuming the project was built with Eclipse directly, Eclipse doesn't use javac at all; it has its own compiler (ecj). [Incidentally this is available separately, which can be useful if you want an open-source java compiler, on relaxed Eclipse license terms, to include with your app. So it's good to know about.]


I would have thought that Eclipse should normally include the system Java extensions when it runs code. However, after a little bit of searching, I did find references that suggest Eclipse potentially runs against a different classpath than it compiles against.

In other words the classpath for running the project may be stored in the launch configuration. I suspect this might cause it to get out of synch if you e.g. change the contents of lib/ext after the first time you run the project. You should be able to see and alter the setup by looking at the launch configuration (I haven't tried this) - alternatively, creating a new launch configuration might fix it.

[Note that I am not 100% certain of the above, as you can tell from the words 'suggest', 'potentially', 'might', etc. I'm not an Eclipse expert, I just use the thing.]

Personally I would second the recommendation not to use extension folders but to include library files within each project that needs them. As well as avoiding this kind of problem, this makes it easier to work with the project on other machines - just checkout from your source repository and you're ready to go. You don't need to remember that 3 years ago on your old machine you happened to install some third-party .jar file in your /Library/Java/Extensions.

--sam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Eclipse - java.lang.NoClassDefFoundError: com/sleepycat/je/DatabaseException (From: Greg Guerin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.