GWT/Eclipse:ClassNotFoundException com/google/gwt/dev/Compiler
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4075839/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GWT/ Eclipse: ClassNotFoundException com/google/gwt/dev/Compiler
提问by hage
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:
我最近从 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.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."
我也无法在 Eclipse 中创建新的 GWT 项目。在新的 New Web Application Project 对话框中,可以选择使用 GWT 和/或 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:
在日志文件 ( <workspace>/.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.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...
gwt-dev.jar、gwt-user.jar 和许多其他 google-jar 都在类路径中...
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...
有谁知道如何解决这个问题?我还设置了一个新的 Eclipse 安装,安装了新的 GWT 插件,并选择了一个新的工作区目录,但这仍然给我错误...
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
- 视窗 XP,
- 适用于 Java EE 3.6 Helios 的 Eclipse,
- J2EE/Java 1.6.0_22-b04
- 适用于 Eclipse 3.6 1.4.0.v201010280102 的 Google 插件,
- 谷歌应用引擎 Java SDK 1.3.8 1.3.8.v201010161055
- 谷歌网络工具包 SDK 2.1.0 2.1.0.v201010280102
采纳答案by Jandar
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.
我遇到了同样的问题,无法在 Eclipse 中创建新的 GWT 项目。从我的 Windows 环境变量中删除 Classpath 变量(显然干扰了 Eclipse 中的设置)为我解决了这个问题。
回答by Lem
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.
我遇到了类似的问题,我经常遇到 java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler。在四处搜索时,我意识到 gwt 版本在 gwt 安装目录中的 gwt-dev 文件夹中丢失了一个文件。
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
实际上,我在我的项目中使用了 maven 和 gwt 2.5.0,我发现在 .m2\repository\com\google\gwt\gwt-dev\2.5.0 文件夹中应该存在四个文件,以便 gwt 编译器工作. 那些是
- 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
- 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
回答by guido
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!
在我的情况下,从 google maven repo 下载的 jar (gwt-dev-2.1.0.jar) 已损坏!我用一个包含类的 jar 替换我的 repo 中的 jar 并且 mvn gwt:run 工作了!
hope this helps.
希望这可以帮助。
回答by Carlos Tasada
Go to your Project Properties / Build Path
there move the "GWT library
" to the top of the BuildPath.
转到你的Project Properties / Build Path
那里,将“ GWT library
”移动到 BuildPath 的顶部。
Now try to recompile again.
现在再次尝试重新编译。
回答by Walter R. Silva
I just, remove and include again gwt-dev.jar and start to work.
我只是删除并再次包含 gwt-dev.jar 并开始工作。
回答by Douglas Tondo
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
- 从您的项目中删除 GWT 库
- 为 Eclipse 更新 gwt 插件
- 将 lib 放回您的项目中
- 完毕
回答by Luigi12
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.
我遇到了同样的问题,安装了一些 java 程序,声明了一个“ClassPath”环境变量,并使任何版本的 eclipse 的 gwt 插件无效,从 3.6(helios)到 4.2(juno)。请注意,Windows 操作系统中的环境变量不区分大小写。解决方案:取消系统/用户变量声明,并在相关程序的启动脚本中声明该变量。
回答by Wei Lin
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.
当GWT编译一个项目时,它需要工具“com.google.gwt.dev.Compiler”(它有一个“main”入口点);但是,GWT 不使用 Eclipse 项目的“构建路径”设置来查找工具,而是查看操作系统的“类路径”系统变量。
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.
所以,我认为解决方案是添加“D:\Java\GWT\gwt-2.6.1\*;” (以我的情况为例)进入“类路径”并重新启动 Eclipse。从那以后它对我来说效果很好。