找不到org.eclipse.swt.widgets.XXX的类文件

时间:2011-07-15 17:45:48

标签: java eclipse swt eclipse-indigo

我正在使用Eclipse Indigo,并且无法编译之前在Ganymede中工作正常的代码。我无法导入任何这些类:

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

我尝试在Eclipse Marketplace中搜索SWT但找不到该库。另外,我读了其他文章,说重建我的项目(我做过),其他人建议下载“JAR”。有谁知道我需要下载什么JAR?或者如何修复我的构建路径,以便它包含这些SWT库?

Classpath(DannyGui应该在那里两次):

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="com.danny.DannyGui.plugin/src"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/swtgraphics2d.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/antlr/stringtemplate-3.2.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/antlr/antlr-2.7.7.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/antlr/antlr-3.1.3.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/antlr/antlr-runtime-3.1.3.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/antlr/gunit.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JacORB/wrapper-3.1.0.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JacORB/antlr-2.7.2.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JacORB/avalon-framework-4.1.5.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JacORB/backport-util-concurrent.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JacORB/idl.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JacORB/jacorb.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JacORB/logkit-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JacORB/picocontainer-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/gnujaxp.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/iText-2.1.3.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/jcommon-1.0.15.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/jfreechart-1.0.12.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/jfreechart-1.0.12-experimental.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/jfreechart-1.0.12-swt.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/junit.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/JFreeChart/servlet.jar"/>
<classpathentry exported="true" kind="lib" path="C:/DannyGui/DannyGui/com.danny.DannyGui.plugin/third_party_libs/log4j/log4j-1.2.15.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

提前致谢。

2 个答案:

答案 0 :(得分:0)

发布的.classpath文件不包含可以加载SWT类的任何内容。这个项目不会像任何版本的Eclipse那样构建。

听起来您正在尝试构建独立的SWT应用程序(而不是说Eclipse插件)。独立应用程序需要类路径上的SWT库。您不会在Eclipse Marketplace上查找SWT,因为您没有寻找扩展Eclipse的插件。您正在寻找一个供您的项目依赖的库。您可以将SWT下载为在系统上某处提取的zip。该zip包含.jar文件和属于SWT实现的本机库。

我会告诉你如何找到它,而不是直接给你一个链接。从Eclipse Platform下载站点开始:

http://download.eclipse.org/eclipse/downloads/

忽略开发构建。查看最新版本。现在,那将是3.7。按照指向构建页面的链接。寻找底部的SWT。下载适合您的系统的zip。提取它并从项目的类路径中添加对包含的jar的引用。

答案 1 :(得分:0)