gwt编译器找不到入口点类

时间:2014-01-27 15:54:47

标签: javascript eclipse gwt compiler-errors entrypointnotfoundexcept

我正在尝试运行一个给我这个错误的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> 

1 个答案:

答案 0 :(得分:0)

自创建项目以来,您是否更改了项目/包名?如果是这样,请确保新名称与“GWT Compile”窗口中的名称和“运行”窗口匹配。

还要确保Project的目录结构与图像中的结构类似: Also make sure your Project's directory structure looks like the one in the image.

如果您确实更改了名称,则应删除war/<old project name>目录中的旧编译输出。

相关问题