Adding external jar in GWT

前端 未结 1 457
时光说笑
时光说笑 2020-12-11 03:09

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

相关标签:
1条回答
  • 2020-12-11 03:37

    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.

    0 讨论(0)
提交回复
热议问题