简体   繁体   中英

How to use eclipse JDT plugin

I installed JDT plugin (I'm running Eclipse 4.2.1) but Eclipse doesn't recognize some types and classes. For example I got "CompilationUnit cannot be resolved to a type". Do I have to import something Eclipse doesn't suggest?

If you are trying to use the JDT libraries in an eclipse plugin project, you will have to add the org.eclipse.jdt.core to the plugin dependencies (in the plugin.xml file).

Else if you are trying to add these to a java application, then you will need to add these to the build path.

Right click on the project and select Properties > Build Path > Add External JARs

Here just add the jdt libraries from the Eclipse plugins directory.

You have to import packages you are using. In this specific case:

import org.eclipse.jdt.core.dom.CompilationUnit;

(if that's the CompilationUnit you are talking about, it's the first hit on Google).

Eclipse can find the correct import automatically for you by pressing Ctrl-Shift-O . (Something I really miss in Visual Studio 2010).

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