gwt
2009-10-30 280 views 0 likes 
0

我想以自己的方式組織我的文件夾,但目前無法運行。GWT:無法加載模塊

這是我的目錄結構

SRC

  • com.tutorial.client
    • DictionaryModule
  • com.tutorial.module
    • Tutorial.gwt.xml

Tutorial.gwt.xml:

<module rename-to="tutorial"> 
    <inherits name='com.google.gwt.user.User'/> 
    <inherits name='com.google.gwt.user.theme.standard.Standard'/> 
    <entry-point class="com.tutorial.client.DictionaryModule"/> 
</module> 

DictionaryModule

package com.tutorial.client; 

import com.google.gwt.core.client.EntryPoint; 
import com.google.gwt.user.client.ui.HorizontalPanel; 
import com.google.gwt.user.client.ui.Label; 
import com.google.gwt.user.client.ui.RootPanel; 

public class DictionaryModule implements EntryPoint { 
    HorizontalPanel dictionaryPanel; 
    Label wordLabel; 

    public DictionaryModule(){ 
     dictionaryPanel = new HorizontalPanel(); 
     wordLabel = new Label("Word"); 
    } 
    @Override 
    public void onModuleLoad() { 
     dictionaryPanel.add(wordLabel); 
     RootPanel.get("dictionary").add(dictionaryPanel); 
    } 
} 

,但我得到這個錯誤:

[ERROR] Unable to find type 'com.tutorial.client.DictionaryModule' [ERROR] Hint: Previous compiler errors may have made this type unavailable [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly [ERROR] Failure to load module 'tutorial'

回答

1

廣場GWT .dml在目錄中ectory含客戶目錄,並添加以下代碼行:

<source path="module" /> 
    <source path="client" /> 
+2

這似乎並沒有工作了。 X( – Jeune 2009-10-31 14:09:35

3

我知道你必須有管理前解決這個年齡,但對於其他人,這是我如何解決了這個:

我有一個使用Hibernate框架的gwt項目,並使用Maven2進行構建管理。

轉到:項目>屬性> Java構建路徑>訂單和導出。現在確保GWT SDK是以上 Maven和JRE/JDK庫。

原因是因爲在多個庫中有多個具有相同名稱的類文件,編譯器無法決定哪個優先考慮哪個,所以我們必須通過指定Ordering來控制這個。

0

只是改變你的目錄結構。

- com.tutorial.module.client 

     DictionaryModule 

- com.tutorial.module 

     Tutorial.gwt.xml 

然後添加以下的Tutorial.gwt.xml

<module rename-to="tutorial"> 
    <inherits name='com.google.gwt.user.User'/> 
    <inherits name='com.google.gwt.user.theme.standard.Standard'/> 
    <entry-point class="com.tutorial.module.client.DictionaryModule"/> 
    <source path='client'/> 
</module> 
相關問題