Mike Hofer
Mike Hofer

Reputation: 17002

Eclipse Plugin - Unable to Resolve Swing Class References

(Disclaimer: Neither of the following are true: (1) Java is my forte, and (2) I'm a pro at Plug-in development.)

My Eclipse plug-in project includes 5 plugins. 2 of them compile just fine. The 3 that don't include dependencies on classes in the org.eclipse.swt.widgets or org.eclipse.swt.graphics packages. The (extremely annoying) compile-time error message is:

The type org.eclipse.swt.widgets.Control cannot be resolved. 
It is indirectly referenced from required .class files.

Now, I've been over this workspace with a fine-toothed comb. I've checked and rechecked the following:

I've googled and stackoverflowed till my eyes are bleeding. None of the typical suggestions seem to be helping.

I'm certain however, that the usual truth is going to prove to be the case here. (All things being equal, the answer is usually something simple, stupid, and painfully obvious.)

Can someone kindly suggest something I haven't yet looked at? I'm more than willing to provide whatever information you may require.

P.S. And might I note that there are way too many places to look to configure dependencies for plugins? Great googly moogly.

Upvotes: 3

Views: 2804

Answers (3)

user14007062
user14007062

Reputation: 11

  1. open eclipse IDE
  2. select menu project->clean
  3. close eclipse IDE
  4. delete .swt from /home/user/.swt
  5. re-open eclipse and fix message

Upvotes: 1

luiss
luiss

Reputation: 373

There is a disconnect between your target platform and the swt plugins available in your environment.

  • In eclipse, go to Help -> Preferences -> Target Platform.
  • Select your target platform and click on [Edit...].
  • In the dialog, select the "Environment" tab.

The fields in the "Target Environment" will be used to load your swt plug-in. The any field not filled in, will default to the values detected for the current environment.

In your case, you have an win32.x86 swt jar. If you are running on 64-bit windows, and the Architecture field is blank, your 32-bit swt jar will not load. You have two options to fix any discrepancies:

  1. Install an eclipse platform pack. It will contain all the swt jars for all the platforms.
  2. Make the "Target Environment" fields match the swt jar you have available.

Upvotes: 7

Morfic
Morfic

Reputation: 15498

That basically means that it is an indirect unsatisfied dependency: a class from a library you're using needs some other class to be on the class-path :)

Now I have no idea how you manage your dependencies (maven or manually) but as a starting point you could use jarfinder.com to find and download the necessary library if you don't have it already: http://www.jarfinder.com/index.php/java/info/org.eclipse.swt.widgets.Control

If you're using Maven, you should look in the logs as it tries to download all the necessary libraries, dependencies included. So if anything went wrong it should point out in the log a connectivity problem or the impossibility of downloading an artefact for some other reason.

Upvotes: 1

Related Questions