我想在 Eclipse 中使用 GWT 启动一个 Web 开发项目。为此,我正在关注 http://www.gwtproject.org/doc/latest/tutorial/create.html
上的教程创建项目的表单并不完全像他们解释的那样。例如,我无法在“使用 Google App Engine”处打勾,因为它不存在。为了获取 build.xml,我选中了“生成 Ant 项目”字段。
当我尝试运行生成的代码时,出现以下错误:
Turning off precompile in incremental mode.
Super Dev Mode starting up
workDir: /tmp/gwt-codeserver-9585554490549923267.tmp
2019-02-03 18:36:10.619:INFO::main: Logging initialized @879ms
Loading Java files in com.google.gwt.sample.stockwatcher.StockWatcher.
[ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
当我尝试使用他们的教程的命令行版本时,我收到 503 错误:
HTTP ERROR: 503
Problem accessing /StockWatcher.html. Reason:
Service Unavailable
Powered by Jetty://
我使用 GWT SDK 2.8.1 和 Java 10
我已经为 Eclipse 安装了很多插件,所以我非常确定拥有我需要的所有插件。也许这可能是 Java 版本的问题?有人有想法吗?
确保您的
JAVA_HOME
指向 JDK
1.8 版本文件夹,因为 ant
将使用它来编译您的源代码
在 Eclipse 上,当您收到此错误时,您应该导航到
Windows->Preferences->Java->Installed JREs
并确保选择的项目实际上是 JDK。
如果不是,请将其更改为您的 JDK 并确保它可以与 Java 1.8 SDK 一起使用。