I have a external jar file named "xxx.jar". I use "xxx.jar" in my GWT project.
When I attempt to build the JavaScript version of my project in Ant, I get one of the following type of errors at every location in which I use xxx. I get a error of this kind when doing the "gwtc" task in Ant, the javac compilation process proceeds just fine.
[ERROR] Line 45: No source code is available for type org.xxx.ObjectName; did you forget to inherit a required module?
Ok, so clearly it is not able to see/use the xxx.jar. Fixing this problem however is not as simple in GWT as it is in "plain" java. From the internet ref1, I gather that I need to
So... What exactly do I do? what is this gwt.xml file I need to generate (Step 2)? Where do I put the source directory, and how to I reference it (Step 1)? What exactly are the mechanical steps necessary to add a external jar file in GWT?
Because your GWT source has to be compiled to JavaScript to work on the client side browser it makes sense that the source code should be available to the GWT compiler.
Check out Lars Vogels article with a brief section on this in his tutorial
It also makes sense, due to the restrictions that Google Outline that all of the code in this JAR may not compile to GWT javascript even if you can get the source.
GWT supports only a small subset of the classes available in the Java 2 Standard and Enterprise Edition libraries, as these libraries are quite large and rely on functionality that is unavailable within web browsers. To find out exactly which classes and methods are supported for core Java runtime packages, see the GWT JRE Emulation Reference
Robert Hanson provides a step by step on how to package GWT components
Good Luck...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With