Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding external jar in GWT

Tags:

gwt

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'
like image 918
Bucks Avatar asked Jan 25 '13 04:01

Bucks


1 Answers

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.

like image 101
Parvathy Avatar answered Nov 02 '22 23:11

Parvathy