Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Plugin project with other project dependencies

I have an Eclipse plugin project, and it depends on other projects that I have in my Eclipse workspace. After adding the project dependencies under "Java Build Path" -> "Projects" tab, and also selecting the project in the "Order and Export" I get a java.lang.NoClassDefFoundError.

I'm assuming that the other projects have not been properly included into the plugin. Does anyone know how to fix this?

Thanks, James

like image 478
James Hu Avatar asked May 19 '10 21:05

James Hu


1 Answers

An Eclipse plug in project manages dependencies differently than a regular Java project.

I'm assuming that you're adding packages with .class files.

Define a library folder in your Eclipse plug-in project. Copy any external classes and / or jars to the library folder.

Open up the MANIFEST.MF file under the META-INF directory. You'll see a formatted editor with 8 tabs on the bottom.

Click on the Runtime tab. Add the external classes and / or jars in the library folder to the Classpath. This will also add these external classes and or jars to the Java Build Path of the project.

Click on the Dependencies tab, and add the other Java projects in the Imported Packages dialog. You have to check the box labeled "Show non-exported packages". If your other Java projects are Eclipse plug ins, add them under Required Plug-ins instead.

like image 156
Gilbert Le Blanc Avatar answered Oct 05 '22 19:10

Gilbert Le Blanc