简体   繁体   中英

Eclipse 4-10 64bit: Cannot resolve SWT library

I try to get started with Eclipse 4-10 and SWT, but importing the SWT Library in the java project doesn't work.

Here is what I did:

  • Download Win 64bit Version of Eclipse 2018-12 and SWT library from here: https://download.eclipse.org/eclipse/downloads/drops4/R-4.10-201812060815/
  • use the Eclipse internal Installer to download and install "SWT Designer" with all it's dependencies from 2018-12 - http://download.eclipse.org/releases/2018-12
  • import the SWT-library-zip-file to the workspace via "File"->"Import"->"Existing projects into workspace"...
  • create a new java project, called testproject
  • get to testprojects "Properities"->"Java Build Path"->Tab "Projects"->Select "Classpath"->"Add"->select the org.eclipse.swt
  • Create an Application Window in my testproject via "create new visual classes"->"SWT"->"Application Window", called testwindow

But the import statements in the testwindow.java still show "the import org.eclipse cannot be resolved".

The setup process is according to the official eclipse site: https://www.eclipse.org/swt/eclipse.php

I use Windows 10 64bit, eclipse and SWT are both 64bit-versions too.

在此处输入图片说明

What am I missing?

In case you have a module-info.java file in the default package, delete it .

Having a module-info.java file enables the optional use of the Java Platform Module System (JPMS) which requires to specify all required modules.

Instead of deleting module-info.java you can also:

  1. In the Java Build Path move the org.eclipse.swt project from the Classpath to the Modulepath
  2. In module-info.java add the line requires org.eclipse.swt;

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