在GWT中添加外部jar

在GWT中添加外部jar,gwt,Gwt,我有一个打包了源代码的jar文件 我在war/WEB-INF/lib/xxx.jar Add to build路径中插入了jar 但是当我运行这个项目时,我犯了一个错误 编辑添加了gwt.xml <module rename-to='bookmanagementsystem'> <inherits name='com.google.gwt.user.User'/> <inherits name='com.google.gwt.user.theme.st

我有一个打包了源代码的jar文件

我在war/WEB-INF/lib/xxx.jar Add to build路径中插入了jar

但是当我运行这个项目时,我犯了一个错误

编辑添加了gwt.xml

  <module rename-to='bookmanagementsystem'>

  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.google.gwt.user.theme.standard.Standard'/>
  <inherits name='com.example.Book'></inherits>
  <entry-point class='com.example.Book.client.Index'/>  
  
</module>

如果您想将外部jar包括到GWT中,那么请确保您执行了以下操作

  • 检查jar是否有.gwt.xml文件,它必须指定源
  • 将其添加到lib文件夹
  • 配置构建路径并将jar添加到库中
  • 从Order和Export中选择jar
  • 在.gwt.xml文件中继承此模块
  • 例如,如果您在jar中有一个名为“sample.source”的包,jar中的.gwt.xml文件是“source.gwt.xml”,这个.gwt.xml文件在“sample”文件夹中,类或实体在“source”文件夹中

    那么您当前的项目必须继承它。它必须有下面的标签

     <inherits name='sample.Source'/>
    
    
    
    例如: jar文件中的Sorce.gwt.xml

    <module>
     <source path="">
     <include name="**/MyEntity.java"/>
     </source>
    </module>
    
    
    
    供参考:http://jonathan.lalou.free.fr/?p=1077

    GWT不支持客户端的序列化,所以请尝试使用RPC并从服务器中的jar使用这些类,或者您只需复制jar的包并添加到GWT项目的src


    我解决了jar文件必须包含java源代码和类文件的问题,或者将java源代码打包到jar中并使用。

    您是否也可以发布.gwt.xml文件代码?您是否确定com.example中有Book.gwt.xml文件?请告诉jar文件的包。检查:)@Parvathy我试过jar,java源代码和类文件仍然是一样的problem@Parvathy现在我遇到了一个错误“没有可用于com.example.module.model.Person类型的源代码;您是否忘记继承所需的模块?[错误]找不到类型“com.yal.BMS.client.Index”@Bucks您是否在.gwt.xml文件中继承了此(com.example.module.model.Person)模块?我的意思是,这个包中有一个.gwt.xml文件,您必须在当前项目的gwt.xml中继承它。我的意思是,如果这个模块不是gwt项目,那么在com.example中创建module.gwt.xml文件,它必须具有以下内容
    <module>
     <source path="">
     <include name="**/MyEntity.java"/>
     </source>
    </module>