How to add external Jar file into GWT project

gwt
16,627

Solution 1

I not solved the problem. Because I found another GWT lib can fulfill my requirement. But I got one suggestion from GWT Forum. I hope it can help u! Please See Below :

Blockquote The library you are trying to use is intended for running in a java VM, not a browser's javascript engine. You need either a javascript library to wrap with JSNI, or a java library that meets the requirements below. Google openid gwt and you'll see how people have been able to use openid with gwt.

Blockquote The GWT java->javascript compiler used to create client browser code does not translate any arbitrary Java library for you. For one, it is limited to emulating a subset of the java JRE, so any library may only use that subset of java JRE functionality. For two, it works on the java source code, so any library you expect to use on the client side must be packaged to include its source. There are plenty of libraries people have packaged for use on the GWT client side, but they are packaged using GWT's packaging standard with an xml description file, must include the source, and use the restricted subset of the JRE. http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsCompatibility.html

Solution 2

You don't have to inherit xxx.gwt.xml if you want to use library on server side code (or in GWT generators). If you want to use library on client side code, you have to also inherit xxx.gwt.xml and if the library does not have this GWT xml file it will not probably work with GWT (it will not be compilable gwt JS compiler). Anyway you can create your own xxx.gwt.xml if you want.

Peter

Solution 3

You will need the source or a xxx.gwt.xml if you plan on using any of the classes included in the jar. You can use the jar without issue on the server side though. See http://www.vogella.com/articles/GWTModules/article.html on an example of creating the xxx.gwt.xml for the jar classes.

Share:
16,627
guaz
Author by

guaz

Updated on June 27, 2022

Comments

  • guaz
    guaz almost 2 years

    I am going to use jacob.jar. But the problem is the jacob jar file don't have xxx.gwt.xml file. So I not able to inherit it into my project xml file.

    How to resolve this problem? or GWT not allow us to add external JAR file?