我在 Eclipse 中安装 GWT 插件后遇到了一些问题,我已经讨论过它们 here 但我还没有找到对我的问题有用的帮助。
所以这里还有另一件事。我可以选择创建Web 应用程序项目。因此,我创建了一个,将其命名为“Demo”,选中“使用 Google Web Toolkit”、“使用默认 SDK 2.6.0”、“使用 Google App Engine”、“默认 1.9.17”,然后单击“完成”。
它生成了一个包含 4 个包的项目,其中 2 个是客户端和服务器,其中有一个红色圆圈,其中有一个 x,表示存在错误。每个类(class)也有它们。
当我点击它们时,它会说:
Syntax error, annotations are only available if source level is 1.5 or greater
它指示我更改它。我证实了这一点,红点之后从类和包中消失,但仍有一个保留在项目目录中。
当我运行该项目时,它在控制台中显示:
Jan 19, 2015 2:09:23 AM com.google.appengine.tools.development.agent.AppEngineDevAgent premain
SEVERE: Unable to load the App Engine dev agent. Security restrictions will not be completely emulated.
java.lang.RuntimeException: Unexpected exception during cast.
at com.google.apphosting.utils.clearcast.ClearCast$CasterImpl.cast(ClearCast.java:385)
at com.google.apphosting.utils.clearcast.ClearCast.staticCast(ClearCast.java:252)
at com.google.apphosting.utils.clearcast.ClearCast.staticCast(ClearCast.java:263)
at com.google.appengine.tools.development.agent.AppEngineDevAgent.premain(AppEngineDevAgent.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Caused by: java.lang.IllegalAccessException: Class com.google.apphosting.utils.clearcast.ClearCast$CasterImpl can not access a member of class com.google.appengine.tools.development.agent.$Proxy0 with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(Unknown Source)
at java.lang.reflect.AccessibleObject.checkAccess(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.google.apphosting.utils.clearcast.ClearCast$CasterImpl.cast(ClearCast.java:383)
... 9 more
有人可以帮助我吗?谢谢。
最佳答案
当我使用 Java 1.8 运行时出现此错误,当我将其更改为 1.7 时,这解决了问题。
编辑:窗口 -> 首选项 -> Java -> 安装的 JRE。检查jre7以使其默认。
关于java - 无法在 Eclipse 中创建 GWT Web 应用程序项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28016308/