[英]gwt compiler can't find entry point classes
我正在尝试运行gwt应用程序,这给了我这个错误。
[ERROR] [studentsystem2] - Unable to find type 'com.example.studentsystem2.client.StudentSystem2'
[ERROR] [studentsystem2] - Unable to find type 'com.example.studentsystem2.client.StudentSystem2'
[ERROR] [studentsystem2] - Unable to find type 'com.example.studentsystem2.client.StudentSystem2'
[ERROR] [studentsystem2] - Unable to find type 'com.example.studentsystem2.client.StudentSystem2'
[ERROR] [studentsystem2] - Unable to find type 'com.example.studentsystem2.client.StudentSystem2'
我该怎么办?
这是我的课程和xml文件。
StudentSystem2.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module rename-to='studentsystem2'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<entry-point class='com.example.studentsystem2.client.StudentSystem2'/>
<source path='client'/>
<source path='shared'/>
</module>
StudentSystem2.java
package com.example.studentsystem2.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
public class StudentSystem2 implements EntryPoint {
public void onModuleLoad() {
RootPanel.get().add(new Enter());
}
}
这是Enter.java代码。
package com.example.studentsystem2.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
public class Enter extends Composite implements HasText {
private static EnterUiBinder uiBinder = GWT.create(EnterUiBinder.class);
@UiField Label SId;
@UiField Label name;
@UiField Label department;
@UiField Button addButton;
@UiField Label label;
@UiField TextBox IdTextField;
@UiField TextBox nameTextField;
@UiField TextBox departmentTextField;
interface EnterUiBinder extends UiBinder<Widget, Enter> {
}
public Enter() {
initWidget(uiBinder.createAndBindUi(this));
}
public Enter(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
addButton.setText(firstName);
}
public void setText(String text) {
addButton.setText(text);
}
public String getText() {
return addButton.getText();
}
@UiHandler("label")
void onLabelClick(ClickEvent event) {
}
@UiHandler("addButton")
void onAddButtonClick(ClickEvent event) {
}
}
和Enter.ui.xml文件
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
<g:AbsolutePanel height="377px">
<g:at left="10" top="48">
<g:Label text="StudentId" ui:field="SId"/>
</g:at>
<g:at left="10" top="117">
<g:Label text="Name" ui:field="name"/>
</g:at>
<g:at left="10" top="190">
<g:Label text="Department" ui:field="department"/>
</g:at>
<g:at left="128" top="32">
<g:TextBox ui:field="IdTextField"/>
</g:at>
<g:at left="128" top="101">
<g:TextBox ui:field="nameTextField"/>
</g:at>
<g:at left="128" top="174">
<g:TextBox ui:field="departmentTextField"/>
</g:at>
<g:at left="172" top="237">
<g:Button width="101px" height="30px" text="Add" ui:field="addButton"/>
</g:at>
<g:at left="17" top="287">
<g:Label text="See Students" ui:field="label"/>
</g:at>
</g:AbsolutePanel>
</g:HTMLPanel>
</ui:UiBinder>
自创建项目以来,您是否更改过项目/程序包名称? 如果是这样,请确保新名称与“ GWT编译”窗口和“运行”窗口中的名称匹配。
还要确保您项目的目录结构看起来像图像中的结构:
如果确实更改了名称,则应删除war/<old project name>
目录中的旧编译输出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.