org.eclipse.swt *。无法解析导入org.eclipse [英] org.eclipse.swt.*; The import org.eclipse cannot be resolved
本文介绍了org.eclipse.swt *。无法解析导入org.eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试编写一个需要import语句的小程序 import org.eclipse.swt。*;
。 (我正在练习这个教程)。
I am trying to write a small program that requires the import statement import org.eclipse.swt.*;
. (I'm practicing with THIS tutorial).
然而,Eclipse不会编译程序并且给我错误导入org.eclipse无法解析
However, Eclipse won't compile the program and is giving me the error "The import org.eclipse cannot be resolved
"
谷歌此次找到答案并不是一个好朋友。
Google hasn't been such a a great friend at finding the answer this time.
推荐答案
这是因为你尚未将SWT库添加到构建路径中。按照教程的步骤进行操作:
This is because you haven't added the SWT library to your buildpath. Follow the steps of the tutorial:
- 下载SWT库。对于3.1.2版本的eclipse,SWT库可以在
http://archive.eclipse.org/eclipse/downloads/drops/R-3.1.2-200601181600/index.php
查找标题为SWT二进制和源的部分。 - 从主菜单工具栏中选择文件,然后选择导入。这样做将打开导入向导对话框。
- 现在选择现有项目到工作区并单击下一步按钮。
- 单击选择存档文件,然后单击浏览按钮。现在找到您在步骤1中下载的SWT存档。
- 单击完成按钮以完成将SWT项目导入工作区。
- 创建新的来自File> New Java Project的java项目。
- 右键单击项目并选择Properties命令打开Properties对话框。
- 选择Java Build Path后跟Projects选项卡,然后单击Add按钮。
- 选择org.eclipse.swt项目并单击OK完成将SWT库添加到项目的类路径
- Download SWT library. For 3.1.2 version of eclipse, SWT library is available at http://archive.eclipse.org/eclipse/downloads/drops/R-3.1.2-200601181600/index.php Look for the section titled SWT Binary and Source.
- From main menu tool bar, select "File" followed by "Import". Doing so will bring up the "Import wizard" dialog.
- Now select "Existing Projects into Workspace" and click on "Next" button.
- Click on "Select archive file" followed by "Browse" button. Now locate the SWT archive that you downloaded in step 1.
- Click the Finish button to finish importing the SWT project into your workspace.
- Create new java project from File > New Java Project.
- Right-click on the project and select the Properties command to open the Properties dialog.
- Select the Java Build Path followed by Projects tab and click the Add button.
- Select the org.eclipse.swt project and click OK to finish adding the SWT libraries to your project's classpath
这篇关于org.eclipse.swt *。无法解析导入org.eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文