org.eclipse.swt.*;导入org.eclipse无法解决
我正在尝试编写一个需要导入语句import org.eclipse.swt.*;
的小程序.(我正在练习 THIS 教程).
但是,Eclipse 不会编译该程序并给我错误无法解析导入 org.eclipse
"
Google 这次在寻找答案方面可不是那么好.
解决方案这是因为您尚未将 SWT 库添加到构建路径中.按照教程的步骤操作:
<块引用>- 下载 SWT 库.对于 3.1.2 版本的 eclipse,SWT 库位于http://archive.eclipse.org/eclipse/downloads/drops/R-3.1.2-200601181600/index.php查找标题为 SWT 二进制和源代码的部分.
- 从主菜单工具栏中,选择文件",然后选择导入".这样做会弹出导入向导"对话框.
- 现在选择Existing Projects into Workspace"并点击Next"按钮.
- 点击选择存档文件",然后点击浏览"按钮.现在找到您在第 1 步中下载的 SWT 存档.
- 单击完成"按钮完成将 SWT 项目导入您的工作区.
- 从文件 > 新建 Java 项目创建新的 Java 项目.
- 右键单击项目并选择属性"命令以打开属性"对话框.
- 选择 Java 构建路径,然后选择项目"选项卡,然后单击添加"按钮.
- 选择 org.eclipse.swt 项目并单击确定"完成将 SWT 库添加到项目的类路径中
I am trying to write a small program that requires the import statement import org.eclipse.swt.*;
. (I'm practicing with THIS tutorial).
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.
解决方案This is because you haven't added the SWT library to your buildpath. Follow the steps of the tutorial:
- 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
相关文章