GWT/Eclipse:ClassNotFoundException com/google/gwt/dev/Compiler

发布于 2024-09-29 21:04:53 字数 3494 浏览 1 评论 0原文

我最近从 GWT 2.0.4 更新到 2.1.0。从那时起我就无法再编译我的 GWT 应用程序了。当我单击 GWT eclipse 插件的 GWT 编译按钮时,出现以下错误:

java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler
Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.Compiler
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Exception in thread "main"

另外,我无法在 Eclipse 中创建新的 GWT 项目。在新的“新建 Web 应用程序项目”对话框中,可以选择使用 GWT 和/或 Google App Engine。当选中“使用 GWT”时,会出现一个错误对话框,其中显示: “创建元素失败。原因:调用 com.google.gwt.user.tools.WebAppCreator 失败。有关更多详细信息,请参阅错误日志。”

在日志文件 (/.metadata/.log) 中,我可以看到以下消息:

!ENTRY org.eclipse.jdt.ui 4 10001 2010-11-02 08:34:50.085
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Core Exception [code 0] Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:50)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: org.eclipse.core.runtime.CoreException: Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.
 at com.google.gwt.eclipse.core.runtime.tools.WebAppProjectCreatorRunner.createProject(WebAppProjectCreatorRunner.java:53)
 at com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.createGWTProject(WebAppProjectCreator.java:532)
 at com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.create(WebAppProjectCreator.java:294)
 at com.google.gdt.eclipse.suite.wizards.NewWebAppProjectWizard.finishPage(NewWebAppProjectWizard.java:147)
 at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:117)
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
!SUBENTRY 1 com.google.gwt.eclipse.core 4 0 2010-11-02 08:34:50.085
!MESSAGE Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.

gwt-dev.jar、gwt-user.jar 和许多其他 google-jar 都在类路径中...

有谁知道如何解决这个问题? 我还设置了新的 Eclipse 安装,安装了新的 GWT 插件,并选择了新的工作区目录,但这仍然给我带来错误...

附加信息:

  • Windows XP、
  • Eclipse for Java EE 3.6 Helios、
  • J2EE / Java 1.6 .0_22-b04
  • Google Eclipse 插件 3.6 1.4.0.v201010280102、
  • Google App Engine Java SDK 1.3.8 1.3.8.v201010161055
  • Google Web Toolkit SDK 2.1.0 2.1.0.v201010280102

i recently updated from GWT 2.0.4 to 2.1.0. Since then I cannot compile my GWT application anymore. When I click on the GWT compile button of the GWT eclipse plugin I get the following error:

java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler
Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.Compiler
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Exception in thread "main"

Also I can't create a new GWT project in Eclipse. In the new New Web Application Project Dialog one can choose to use GWT and/or Google App Engine. When check "Use GWT" a error dialog raises up which says:
"Creation of element failed. Reason: Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details."

In the log file (<workspace>/.metadata/.log) I can see the message:

!ENTRY org.eclipse.jdt.ui 4 10001 2010-11-02 08:34:50.085
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Core Exception [code 0] Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:50)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: org.eclipse.core.runtime.CoreException: Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.
 at com.google.gwt.eclipse.core.runtime.tools.WebAppProjectCreatorRunner.createProject(WebAppProjectCreatorRunner.java:53)
 at com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.createGWTProject(WebAppProjectCreator.java:532)
 at com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.create(WebAppProjectCreator.java:294)
 at com.google.gdt.eclipse.suite.wizards.NewWebAppProjectWizard.finishPage(NewWebAppProjectWizard.java:147)
 at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:117)
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
!SUBENTRY 1 com.google.gwt.eclipse.core 4 0 2010-11-02 08:34:50.085
!MESSAGE Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.

gwt-dev.jar, gwt-user.jar and many other google-jars are in the classpath...

Does anyone have an idea how to solve this issue?
I also set up a new fresh Eclipse installation, installed the new GWT plugin, and chose a new workspace directory, but this still gives me the errors...

Additional information:

  • Windows XP,
  • Eclipse for Java EE 3.6 Helios,
  • J2EE / Java 1.6.0_22-b04
  • Google Plugin for Eclipse 3.6 1.4.0.v201010280102,
  • Google App Engine Java SDK 1.3.8 1.3.8.v201010161055
  • Google Web Toolkit SDK 2.1.0 2.1.0.v201010280102

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

ゝ杯具 2024-10-06 21:04:54

我遇到了同样的问题,无法在 Eclipse 中创建新的 GWT 项目。
从我的 Windows 环境变量中删除 Classpath 变量(显然会干扰 Eclipse 中的设置)解决了我的问题。

I had the same problem not being able to create a new GWT-project in Eclipse.
Removing the Classpath variable from my windows environment variables (appearently interfering with the settings in Eclipse) solved the problem for me.

虫児飞 2024-10-06 21:04:54

就我而言,从 google maven repo 下载的 jar (gwt-dev-2.1.0.jar) 已损坏!我将存储库中的 jar 替换为包含类的 jar,并且 mvn gwt:run 工作了!

希望这有帮助。

In my case the jar (gwt-dev-2.1.0.jar) downloaded from the google maven repo was corrupt! I replace the jar in my repo with a one containing the classes and mvn gwt:run worked!

hope this helps.

绝不服输 2024-10-06 21:04:54

我遇到了类似的问题,我不断收到 java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler。在四处搜索时,我意识到 gwt 版本缺少 gwt 安装目录内的 gwt-dev 文件夹中的文件。

实际上,我在项目中使用 maven 和 gwt 2.5.0,我发现 .m2\repository\com\google\gwt\gwt-dev\2.5.0 文件夹中应该存在四个文件,以便 gwt 编译器正常工作。
这些是

  • gwt-dev-2.5.0.jar <-有时这是损坏的
  • gwt-dev-2.5.0.jar.sha1 <-这个缺少
  • gwt-dev-2.5.0.pom
  • gwt-dev-2.5 .0.pom.sha1

I was facing a similar issue where I was getting constantly java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler. While searching around I realized that the gwt version was missing a file from inside the gwt-dev folder inside the gwt installation directory.

Actually, I am using maven and gwt 2.5.0 for my project, and I discovered that inside .m2\repository\com\google\gwt\gwt-dev\2.5.0 folder should exist four files in order for gwt compiler to work.
Those are

  • gwt-dev-2.5.0.jar <-sometimes this is corrupted
  • gwt-dev-2.5.0.jar.sha1 <- this one was missing
  • gwt-dev-2.5.0.pom
  • gwt-dev-2.5.0.pom.sha1
兔小萌 2024-10-06 21:04:54

转到您的项目属性/构建路径,将“GWT 库”移动到构建路径的顶部。

现在再次尝试重新编译。

Go to your Project Properties / Build Path there move the "GWT library" to the top of the BuildPath.

Now try to recompile again.

青瓷清茶倾城歌 2024-10-06 21:04:54

我只是删除并再次包含 gwt-dev.jar 并开始工作。

I just, remove and include again gwt-dev.jar and start to work.

神经暖 2024-10-06 21:04:54

我这样做解决了这个问题:

  • 从项目中删除 GWT lib
  • 更新 eclipse 的 gwt 插件
  • 将 lib 放回项目中
  • 完成

I fix that problem doing this:

  • remove GWT lib from your project
  • update gwt plugins for eclipse
  • put the lib back in your project
  • Done
不喜欢何必死缠烂打 2024-10-06 21:04:54

我遇到了同样的问题,安装了一些java程序,声明了“ClassPath”环境变量,并使任何版本的eclipse(从3.6(helios)到4.2(juno))的gwt插件无效。
请注意,Windows 操作系统中的环境变量不区分大小写。
解决方案:消除系统/用户变量声明,并在相关程序的启动脚本中声明该变量。

I had the same problem, some java program had been installed declaring a "ClassPath" environment variable, and invalidating the gwt plugin for ANY version of eclipse, from 3.6 (helios) to 4.2 (juno).
Note that environment variables are case-insensitive in Windows OSs.
Solution: eliminate the system/user variable declaration and declare the variable in a/the launch script for the concerned program.

咋地 2024-10-06 21:04:54

我的理解是:

当GWT编译一个项目时,它需要工具“com.google.gwt.dev.Compiler”(它有一个“main”入口点);但是,GWT 不使用 Eclipse 项目的“构建路径”设置来查找该工具,而是查看操作系统的“类路径”系统变量。

所以,我认为解决方案是添加“D:\Java\GWT\gwt-2.6.1\*;” (以我的情况为例)进入“类路径”并重新启动 Eclipse。从那以后它对我来说效果很好。

My understanding is:

When GWT compiles a project, it needs the tool "com.google.gwt.dev.Compiler" (which has a "main" entry point); however, GWT does not use Eclipse project's "build path" setting to find the tool, instead, it looks at OS's "classpath" system variable.

So, I think the solution is to add "D:\Java\GWT\gwt-2.6.1\*;" (my case as example) into "classpath" and restart Eclipse. It works well for me since.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文