【发布时间】:2014-06-02 20:43:11
【问题描述】:
我正在尝试学习 java 的这个新的 GWT 部分...
我制作了我的第一个简单的应用程序
我命名
- 我的模块:- HelloWorld
- 我的入口点类:- 你好
- 还有我的html:index.html
我收到此错误:
2014 年 4 月 18 日下午 4:00:53 java.util.prefs.WindowsPreferences 警告:无法打开/创建首选项根节点 Software\JavaSoft\Prefs 在根 0x80000002。 Windows RegCreateKeyEx(...) 返回错误代码 5。 加载模块 com.test.GWTTestProject 加载继承的模块“com.test.GWTTestProject” [错误] 在您的类路径中找不到“com/test/GWTTestProject.gwt.xml”;可能是错字,或者您忘记包含 源的类路径条目? [ERROR] shell 在 doStartup 方法中失败
模块:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="Hello">
<inherits name="com.google.gwt.user.User" />
<source path="client" />
<entry-point class="com.test.client.Home"></entry-point>
</module>
入口点类
package com.test.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
public class Home implements EntryPoint {
public void onModuleLoad() {
RootPanel.get().add(new Label("Hello World"));
}
}
索引文件
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>index</title>
<script type="text/javascript" language="javascript" src="Hello/Hello.nocache.js"></script>
</head>
<body>
</body>
</html>
【问题讨论】:
-
GWTTestProject.gwt.xml 在哪里?您需要该文件进行编译。您是如何创建项目的?
-
我没有创建这个文件...我使用附带的 g 符号创建了项目...
-
GTD Pulldown->新建Web应用项目
-
你用的是什么IDE?
-
复制你的模块文件到 com/test/GWTTestProject.gwt.xml