GWT Hello World项目编译报错,提示缺少com.google.gwt.core.Core
Hey there, let's work through this frustrating compile error you're hitting with your GWT Hello World project. Even though you've confirmed your module inherits com.google.gwt.user.User, there are a few common culprits here—especially with your setup using JDK 12 and GWT 2.8.1. Here are the steps to fix this:
1. Fix JDK Version Compatibility (Most Likely Root Cause)
GWT 2.8.1 officially only supports JDK 8; JDK 9 and above introduced module system changes and deprecated APIs that break GWT's older compiler. Even if your module XML looks correct, the JDK version mismatch can trigger misleading error messages like the one you're seeing.
- Install JDK 8 (make sure it's a full JDK, not just JRE)
- In Eclipse, right-click your
Gwt5project → Properties- Go to Java Build Path → Libraries
- Remove the JDK 12 entry, then add JDK 8 as your JRE System Library
- Switch to Java Compiler tab, check "Use compliance from execution environment on the 'Java Build Path'", and select JDK 8 from the dropdown
2. Double-Check Your Module XML File
Even if you didn't modify it, it's worth verifying the exact content of your Gwt5.gwt.xml file to rule out typos or accidental changes. It should look exactly like this:
<module rename-to='gwt5'> <!-- Inherit core GWT functionality --> <inherits name='com.google.gwt.user.User'/> <!-- Define your app's entry point --> <entry-point class='com.foo.client.Gwt5'/> <!-- Specify source code paths for GWT to compile --> <source path='client'/> <source path='shared'/> </module>
Ensure the <inherits> tag is present, spelled correctly, and has no extra spaces or typos.
3. Clean Your Project & Eclipse Cache
Eclipse's cached build files can sometimes cause unexpected issues. Try these steps:
- Go to Project → Clean, select your
Gwt5project, and click "OK" - If that doesn't work, close Eclipse, delete the following from your project directory:
.classpathfile.projectfile.settingsfolder
- Reopen Eclipse and re-import your project
4. Verify GWT SDK Configuration in Eclipse
Make sure Eclipse is using the correct GWT SDK and there's no conflicting SDK setup:
- Go to Window → Preferences → Google → Web Toolkit
- Confirm only GWT 2.8.1 is listed and selected, and the path points to your installed SDK directory
- Right-click your project → Properties → Google → Web Toolkit, ensure the correct SDK is checked for your project
After trying these steps, re-run the GWT Compile Project command—it should resolve the error.
内容的提问来源于stack exchange,提问作者Clint

