[英]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.