简体   繁体   中英

I have my buildpath right, but when I run my eclipse plugin command, it doesn't find the classes

I'm creating my first eclipse plugin and it compiles, all is fine. But when I run the eclipse application, when I click the new Menu Option to test my menu command, the classes my plugin uses that are from jars that I had to include in the buildpath as referenced libraries are not found (ClassNotFoundException). Those jars are org.eclipse.jdt.core.[number] and org.eclipse.core.resources.[number]. So far, the exception was thrown only for JDT classes, either because it didn't reach any classes from the other jar or because the other jar can be found by the command (I think the it's the latter).

How to fix that?

All the jars that your plugin uses must be either included in your plugin or be part of another plugin. Never just put things in the Java Build Path for plugins.

References to other plugins must be listed in your plugin's MANIFEST.MF file in the Require-Bundle entry. You can set these in the MANIFEST.MF editor on the 'Dependencies' tab in the 'Required Plugins' section.

org.eclipse.jdt.core and org.eclipse.core.resources are both plugins so they are normally listed in 'Require-Bundle'.

Jars in your plugin must be listed in the MANIFEST.MF in the Bundle-Classpath entry. Set these in the MANIFEST.MF editor on the 'Runtime' tab in the 'Classpath' section.

Jars you include in your plugin must also be listed in the 'build.properties' file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM