GWT v.s. Java2Script SWT

Google has released Google Web Toolkit (GWT), ….

Aha, google is doing the same thing as me: Java2Script Pacemaker.

The same pattern: Java-to-JavaScript compiler, provide general java.lang.* and java.util.*, and an extra UI widget library.
In Google Web Toolkit, the UI widgets is GWT, while in Java2Script Pacemaker, it is Eclipse’s Standard Widget Toolkit (SWT).It seems GWT is a much lighter library than SWT. Currently Java2Script’s SWT is growing to about 400k of *.js files for about 80%+ API support. After compression the file size is about 250k. 250k v.s. 100k. Hoho it seems J2S’ SWT need more works.

Some more comparisions of GWT and Java2Script:

  • Now GWT has no IDEs support but can be developed within Eclipse, while Java2Script Pacemaker is a plugin extending Eclipse JDT plugin, so its UI is Eclipse SDK. Java2Script is not a standalone application.
  • GWT’s UI may not be reused on desktop, while J2S’ SWT is another implementation of SWT’s API. That is to say, it’s SWT on Browser besides SWT on Win32, SWT on GTK, SWT on PPC, … So SWT applications developing for desktop can be reused or directly exported to web browser.
  • GWT’s UI is for web, and SWT is for both deskop and web. And J2S’ SWT looks more similar to desktop application.
  • GWT has been integrated with Java EE, while Java2Script is still not (Planned but not yet implemented).
  • For license, GWT is on its own license, J2S is licensed under the much well-known Eclipse Public License 1.0.
  • About releases, GWT is now 1.0.20, while Java2Script is before 1.0.0 M2 besides its ealier 0.1.0 to 0.5.0 and 1.0.0 M1.

Aha, Java2Script Pacemaker welcomes you.

/js (*_*)

This entry was posted in Java, Java2Script News, JavaScript, Uncategorized. Bookmark the permalink.

11 Responses to GWT v.s. Java2Script SWT

  1. I learned about Java2Script today as I learned about GWT today and Java2Script was mentioned on their forum.

    Looks like a cool framework, good luck with it, and I’m exited that both GWT and Java2Script focus on actual object oriented programming instead of the latest fad to get away from it.

  2. Jim White says:

    I too just learned of J2S as a result of starting to use GWT.

    A great feature of J2S is that the Java-to-JavaScript compiler is open source while GWT’s compiler is free but no source.

    I hope you will add GWT compiler compatibility to J2S so that we can compile the GWT runtime with it.

    I am especially interested in an implementation in which the GWT annotations are compiled into Java 5 bytecode annotations which can then be compiled by J2S.

  3. Josson Smith says:

    @Eelco
    I think J2S will take its best to help developers for a better web applications.

    @Jim
    I will take annotations as a feature request for J2S.

    But “Java 5 bytecodes annotations” (?) may not be implemented as J2S mainly focus on Java Source not Java bytecodes.

    Welcome to the world of J2S.

  4. Hannes P. says:

    I now have spent almost a week of testing gwt and j2s and I must say that i think that j2s is IMHO much better than gwt. Mainly that it is integrated so well in eclipse, makes it really easy to make web applications. So please keep up your work, and I wish you the best!

  5. Josson Smith says:

    @Hannes
    Thanks for your wishes.

  6. Sriram Narayanan says:

    I learnt of j2s from the GWT forums. This seems interesting. The ebst if the license.

  7. Jason Thomas says:

    This is flippin’ amazing. Hats off to you! I’ve used GWT off and on since it came out. I was shocked about how similar it was to Swing/SWT. As far as I can tell it’s a work in progress. The simple widgets it provides can produce a pretty sophisticated web-application, although attaching RPC web-services is a bit clunky, and there are quite a few bugs and caveats.

    I’m currently developing a Db4o backed signup sheet for a physics project I work on (Trying to keep to MVC, and attaching Ruby on RAILS like validations, although this is difficult because GWT doesn’t implement reflection). But this, this ‘is’ SWT, you’ve nearely implemented the entire kitchen sink for SWT. When I saw GWT, I thought to myself that this was the beginning of an era beyond CGI, where desktop applicaiton engineers, and professional software developers could use the web as merely a user interface. Apparently it’s a hell of a lot closer than I thought.

  8. D says:

    Can j2s (or another free tool) compile a Netbeans Swing UI into javascript? I begin with a JFrame Form. If so, then how?

    In Tutorial of J2S in Eclipse (1): Hello J2S World, I am using Eclipse SDK version 3.1.1. But I do not have “Pattern” under the Java2Script compiler is enabled button, which is in the Java2Script Builder page, in the Hello J2S World section. I do get “Run as Java2Script Application”. But maybe I did not get the automatic build of the *.js?

    My runtime error is Line 1: ‘Clazz’ is undefined.
    When I debug, it shows:
    Clazz.declarePackage (“net.sf.j2s.hello”);
    in HelloJ2SWorld.js

  9. Zhou Renjian says:

    The tutorials of J2S are out of date (I will try to update them in this month). For your problem, you should add some necessary libraries, like j2s-core-common.z.js in the builder page.

    There are some few words about these at:
    http://j2s.sourceforge.net/overview.html#using-j2s

    And theoretically developing a JavaScript version of SWING by Java2Script could be feasible. But currently Java2Script project has no plan for such a things. And I think Java2Script will not support Netbeans IDE. It’s because Java2Script relies heavily on Eclipse JDT plugin.

  10. Zhou Renjian says:

    @Jason
    “…attaching RPC web-services is a bit clunky…”
    Currently Java2Script is still not attaching RPC web-services. Maybe Java2Script will try to provide some interfaces instead of implementations. I am thinking and studying about this these days.

  11. Pingback: Inside Java2Script » Blog Archive » Regarding GWT