Use of existing java applications/ jars in a GWT project

102 views
Skip to first unread message

Ani

unread,
Dec 9, 2016, 11:24:52 AM12/9/16
to GWT Users
Hi
  I have an application based on eclipse GEF, and am trying to build one based on GWT which has the same functionality.
I am a new user , so please excuse me if this is a very basic question
   We have a a lot of existing java code, and libraries which need to be used.
It does appears that the GWT compiler does look for a module definition , if any code from those libraries can be used.
My question is
  - Would i need to change the existing jars, to add a module definition to each of them ?
  - DOes the GWT compiler need the actual source code too for each of these.
   If that is indeed the case, it might make the porting of an existing application to GWT difficult.
Any pointers are appreciated

Best Regards
Ani

Jens

unread,
Dec 9, 2016, 11:40:26 AM12/9/16
to GWT Users

  - Would i need to change the existing jars, to add a module definition to each of them ?

No you can define the module definition externally.

 
  - DOes the GWT compiler need the actual source code too for each of these.

Yes GWT compiler needs the source code of your jars as well. For example if you use Maven/Gradle you would depend on the normal dependency as well as the same dependency using the "sources" classifier to get the sources jar as well.


-- J.

Ani

unread,
Dec 9, 2016, 4:16:04 PM12/9/16
to GWT Users
HI Jens
   Thanks for the reply
   - How do we define GWT modules externally , for classes in third party jars
Sorry if this is pretty basic

- And if the source code is needed by GWT compiler, if we have third party jars , with no source code, then they cannot be used as part of the GWT app
  Would that be a correct statement

Thanks
Ani

Lars

unread,
Dec 10, 2016, 2:12:36 AM12/10/16
to GWT Users
You have to build a similar package structure (as the external jar) and put the definition in this. This could be packaged in another jar or in your source tree.
If you do not have the source, then you cannot use this to build javascript code! But you could still use it in a servlet and connect it via ajax calls.

Lars

unread,
Dec 10, 2016, 10:29:50 AM12/10/16
to GWT Users
in case you do not have the sources may http://teavm.org helps to move this to javascript ... and then you could use JsInterop (or JSNI) to call it from GWT :-)

Jens

unread,
Dec 10, 2016, 12:56:31 PM12/10/16
to GWT Users

HI Jens
   Thanks for the reply
   - How do we define GWT modules externally , for classes in third party jars

Just like normal GWT modules, its only important that they are in the correct package, e.g. if you want to use com.3rdparty.math.* you could create com/3rdparty/Math.gwt.xml and use <source path="math"/> to make the code available to GWT compiler. You can either store the Math.gwt.xml file in your main project source directory or make a dedicated project you depend on.
 


- And if the source code is needed by GWT compiler, if we have third party jars , with no source code, then they cannot be used as part of the GWT app
  Would that be a correct statement

Yes, if there is no way to get the source code, you can not use GWT. In that case you have to use a solution based on class files only like teaVM. But given that you can decompile Java classes you might still be able to use GWT by recreating the source from the classes. However I never tried it.


-- J.
 

Aniruddha Shevade

unread,
Dec 10, 2016, 3:26:34 PM12/10/16
to google-we...@googlegroups.com
Hi
 Thanks for all those suggestions.
I will try to see how teavm works.

We have an full enterprise application , build on eclipse GEF framework which needs to be moved to web.It depends on tons of other jars
I was looking into GWT as a means. But kind of dont feel very good about the requirement of source code, though I understand its need
May be my existing application is not a good candidate for GWT  , due to this requirement.

That being said, I will try TeaVM
Decompiling: not sure how many level deep I will have to dcompile.


Thanks



--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsub...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages