java.lang.NoClassDefFoundError when loading a class in a second project
I have an Eclipse RCP plugin project that works when all the code is in one project. There are 3 packages and I want to use one of these packages in another RCP plugin. Therefore, I decided to move this package into a second project that can be part of both RCP workspaces. I include the second project in "Java build Path" -> "Projects" and there is a "-" in the "Order and Export" of the second project (it will not allow me to change this)
When debugging the plugin it gives "java.lang.NoClas开发者_JAVA百科sDefFoundError" on a class in the second project. I cannot figure out how to connect the two projects together. Can another please advise.
I have managed to resolve the problem of connecting the two projects.
In addition to Andy's two points: (1) add a dependency to the first project in the second project's manifest.mf -> Dependencies -- under both "Required plugins" and "Imported packages" add reference to the the first project (2) check the project in the "add required plug" section of the launcher... You have to export the necessary packages from the first project. This is done in the manifest.mf -> Runtime -> Exported packages
In the depending plug-in, open META-INF/MANIFEST.MF, via Open With...>Plug-in Manifest Editor. On the Dependencies tab, ensure that your new plug-in is listed among the dependencies.
After that, in your launchers and *.products, look for a button labeled Add Required Plug-ins. Press it. Verify that your new plug-in has been added.
精彩评论