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

Java 找不到org.eclipse.swt.widgets.XXX的类文件,java,eclipse,swt,eclipse-indigo,Java,Eclipse,Swt,Eclipse Indigo,我正在使用EclipseIndigo,无法编译一些以前在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; i

我正在使用EclipseIndigo,无法编译一些以前在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库

类路径(DannyGui应该出现两次):



提前感谢。

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

听起来您正试图构建一个独立的SWT应用程序(而不是Eclipse插件)。独立应用程序需要类路径上的SWT库。您不会在Eclipse Marketplace上寻找SWT,因为您不会寻找扩展Eclipse的插件。您正在寻找项目所依赖的库。您可以将SWT作为zip下载,并将其解压缩到系统的某个地方。zip包含.jar文件和本机库,它们是SWT实现的一部分

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


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

3.7的最新swt:

我应该添加,这里是我的实际错误:项目没有生成,因为它的生成路径不完整。找不到org.eclipse.swt.widgets.Composite的类文件。修复生成路径,然后尝试生成此项目。未生成项目,因为其生成路径不完整。找不到org.eclipse.swt.widgets.Composite的类文件。修复生成路径,然后尝试生成此项目。您可以发布项目的.classpath文件的内容吗?我已更正,我刚刚将项目导入Ganymede,我收到了相同的错误。所以,您可能已经找到了一些东西,可能是类路径…好的,我明白了…-右键单击Eclipse包资源管理器中的项目,选择属性,单击左侧的Java构建路径。-单击“添加外部罐子…”按钮。-添加\plugins\org.eclipse.swt_3.7.0.v3735b.jar和org.eclipse.swt.win32.win32.x86_3.7.0.v3735b.jar(您的主目录是您下载的@Konstantin目录,或者您的eclipse主目录(如果文件在那里),更改特定名称以匹配您的操作系统和swt构建)然后清理并重建项目。谢谢@Konstantin的帮助。是的,您可以回顾一下自己的Eclipse安装,但我不建议这样做。这对确定完成后需要分发的内容没有任何帮助,因此在最后你会忙着整理它。在将来避免一些麻烦,并在考虑这一点时下载一个单独的SWT发行版。
<?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>