Eclipse WindowBuilder: Unknown GUI Toolkit/Cannot Resolve Imports when class file under src folder
Asked Answered
M

2

1

On Eclipse (OS X) when I create a SWT/JFace Java Project, then create an Application Window Java class file I cannot seem to resolve org.eclipse.swt imports. On the other hand, if I create a SWT/JFace Java Project and select "Use project folder as root for sources and class files" the import resolves and everything works fine. The imports also seem to resolve in the former case when I drag my .java file outside of the src folder and put it directly into the project folder, but in this case I don't have the option of selecting the 'Design' tab.

What should I do so that my org.eclipse.swt imports work inside the src folder?

Monochromat answered 26/1, 2019 at 21:38 Comment(0)
V
1

This sounds like SWT is missing on the Java Build Path.

Follow these instructions and downloaded the SWT binaries and sources from here.

If you move a .java file outside the source folder (in your case src), the Java editor icon will change form a normal J to an outline J indicating that the Java code is no longer being compiled: import statements do not have to be resolved and therefore are not displayed as errors.

Visage answered 27/1, 2019 at 13:42 Comment(1)
Yes, missing the SWT libraries may crash WindowBuilder, even when you are not using SWT at all!Moua
D
1

Try to add:

requires java.desktop;

to your module-info.java

Draggle answered 24/6, 2019 at 3:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.