简体   繁体   中英

How do I determine where a package is being referenced from in Eclipse?

I have two different copies of an open source project, one that builds and one that doesn't. The one that doesn't build is saying:

Description Resource    Path    Location    Type
The project was not built since its build path is incomplete. Cannot find the class file for javax.crypto.SecretKey. Fix the build path then try building this project  Server      Unknown Java Problem
The type javax.crypto.SecretKey cannot be resolved. It is indirectly referenced from required .class files  DefaultConfigurationController.java /Server/src/com/mirth/connect/server/controllers    line 1  Java Problem

and these two classes have been highlighted by eclipse

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;

In the project that builds, how do I determine where it is resolving these references from?

Press F3 on the type of interest and press Link with editor in Package explorer view.

On the other hand if you would like to see all the references of a given class , field or method press Ctrl + Shift + G .

Probably the quickest/easiest way is to right-click on the project and go to:

Build Path | Add External Archives...

I think you're after "jce.jar", which is found in the "lib" folder of your JDK - browse to this folder and add the jar.

A slightly more elegant way is to use the following:

Build Path | Add Libraries.. | User Library

Hope that helps.

This is very silly error, i solved this by following way...

Right click on projcet->properties->Java Build Path.

Now select Libraries tab and press Add Library then select JRE System Library->next->Finish.

Now all errors will gone.

Ctrl+click the class name either from the import or a usage.

The used file should show up in a new editor window (with or without source)

Right Click the editor window, Show in -> Project Explorer

It'll select the file from the jar/lib it's in in the explorer, you can scroll up in the window if needed to see what lib / jar it came from.

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