Reputation: 999
I'll be involved in Java development for the first time. The application will be built on an set of Eclipse plug-ins and packages called UDOP. This set comes with tutorials, which I'm going through.
Yesterday things were fine, and in my example code I was able to import a certain package, and extend one of the classes it contains. When I started Eclipse today, a package in an import statement has a red line under it, with a hover-message telling me that the import cannot be resolved. The target platform is correct, and my dependencies match what the tutorial wants. I've run Update Classpath.
Details:
the import statement is
import com.tdkc.udop.extensionpoints.views.ViewPartBase;
The red squiggly line is under com.tdkc.udop.extensionpoints.
com.tdkc.udop is set as a dependency.
The Target Platform is .../UDOP_SDK,
and under that I can find the file .../UDOP_SDK/plugins/com.tdkc.udop_1.7.0/com/tdkc/udop/extensionpoints/views/ViewPartBase.class
com.tdkc.udop appears in the Package Explorer, and from within the P.E. I can navigate down and see ViewBasePart.class.
Although I'm new at Eclipse and Java, I do have moderate experience with c++ and Objective-C and Cocoa.
What are possible causes for an import not to be found? What should I check? Thanks.
Upvotes: 6
Views: 9158
Reputation: 909
Move your cursor to the error line(com.tdkc.udop.extensionpoints. in your case) then Eclipse will show you the list from which you can get rid of that error. Scroll down find Fix Project Setup and then Eclipse will suggest jar files which can be added to solve dependency problem. add those dependency by clicking OK.
and error will disappear.
Upvotes: 0
Reputation: 18869
If nothing has changed since the last time everything was peachy, it might just be a matter of doing a Project -> Clean
and then selecting Clean all projects
like so:
Finally, click on OK
and Eclipse should clean out all the projects and build everything.
Upvotes: 8
Reputation: 101
If that import statement is what you've used, the syntax is wrong. It should be:
import com.tdkc.udop.extensionpoints.views.ViewPartBase;
Upvotes: 1
Reputation: 4010
On the project in question (Left side of Eclipse in "Package Explorer"), right click on the project name and select "Build Path" > "Configure Build Path...".
On the left side, select "Java Build Path", then the tab "Libraries". From there, "Add JARs..." and point to the JAR file that contains your class. From there try and build/clean.
Upvotes: 3