hage
hage

Reputation: 6163

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

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:

Upvotes: 6

Views: 21541

Answers (8)

Wei Lin
Wei Lin

Reputation: 165

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.

Upvotes: 0

Luigi12
Luigi12

Reputation: 1

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.

Upvotes: 0

Douglas Tondo
Douglas Tondo

Reputation: 81

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

Upvotes: 0

Walter R. Silva
Walter R. Silva

Reputation: 1

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

Upvotes: 0

Lem
Lem

Reputation: 419

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

Upvotes: 1

Jandar
Jandar

Reputation: 56

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.

Upvotes: 4

guido
guido

Reputation: 687

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.

Upvotes: 1

Carlos Tasada
Carlos Tasada

Reputation: 4444

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

Now try to recompile again.

Upvotes: 0

Related Questions