在GWT中添加外部jar [英] Adding external jar in GWT

查看:429
本文介绍了在GWT中添加外部jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我将jar插入到war / WEB-INF / lib / xxx.jar中添加到构建路径

p>

但是当我运行该项目时出现错误



编辑添加了gwt.xml

 < module rename-to ='bookmanagementsystem'> 

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

< / module>

已编辑

我解决了
插件无法连接到开发模式服务器127.0.0.1:9997



现在我遇到了一个问题

 加载继承模块'com.example.book'
[错误]无法找到'com / example / book。 gwt.xml'在你的类路径上;可能是拼写错误,或者您可能忘记为源代码包含类路径条目?
[错误]第6行:处理元素'继承'时出现意外异常


解决方案

如果你想包含外部jar到GWT,那么确保你做了下面的事情:检查jar是否有以下内容:



  1. 将它添加到lib文件夹

  2. 配置构建路径并将jar添加到库

  3. 从订单和导出中选择jar

  4. 在您的.gwt.xml文件中继承此模块

例如。如果jar包中有一个名为sample.source的包,并且jar中的.gwt.xml文件是Source.gwt.xml,并且这个sample文件夹中的.gwt.xml文件以及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中。

OR

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

I have a jar file with source code packed.

i inserted the jar in war/WEB-INF/lib/xxx.jar Add to build path

but when i run the project i got an error

Edited Added 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>

Edited

I solved Plugin failed to connect to Development Mode server at 127.0.0.1:9997

Now i got a problem

Loading inherited module 'com.example.book'
         [ERROR] Unable to find 'com/example/book.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
      [ERROR] Line 6: Unexpected exception while processing element 'inherits'

解决方案

If you want to include external jar to GWT then make sure you did the following

  1. check the jar has .gwt.xml file and it must specify the source.
  2. add it to lib folder
  3. configure build path and add jar to libraries
  4. select the jar from Order and Export
  5. inherits this module in your .gwt.xml file

Eg. if you have a package in jar named "sample.source" and your .gwt.xml file in jar is "Source.gwt.xml" and this .gwt.xml file in "sample" folder and classes or entities in "source" folder

Then your current project must inherits it. ie it must have the following tag

 <inherits name='sample.Source'/>

Eg : Sorce.gwt.xml in jar file

<module>
 <source path="">
 <include name="**/MyEntity.java"/>
 </source>
</module>

For reference :http://jonathan.lalou.free.fr/?p=1077

GWT is not supporting serialization in client side so try to use RPC and use these classes from jar in server or you just copy the packages of jar and add to src of gwt project.

OR

I solved the problem the jar files must have java source code along with class files or pack java source code into jar and use.

这篇关于在GWT中添加外部jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆