Category Archives: Sharing

Hosting Update Manager on Sourceforge’s Mirrors

Now Java2Script can be installed from Eclipse Update Manager with URL:

It will redirect the download traffics to Sourceforge’s mirrors, so it will be safe and fast.

More technical details about hosting Eclipse plugin update manager on Sourceforge’s mirrors:

First, create your feature project and update site project. site.xml support mirrorURL attribute, you can create the mirrors.xml for your project’s mirror list of

Second, you should map those “plugins/*.jar” to “*.jar” without the prefix “plugins/”.

Third, you should use “.htaccess” to redirect the default *.jar downloads (Someone will always select the default server, which is is not sourceforge mirror, to install) to a default mirror server. The “.htaccess” may looks like:

RewriteEngine On
RewriteBase /update/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^net\.sf\.j2s\.(.*)\.jar$$1.jar [R]

Last, use “File Release Sytem” to release your *.jar and site.xml, and update your .htacces, site.xml with features/*.jar (always small in size) into web site. And then test the installation.

Plugging into

Posted in How To, Java2Script News, Sharing | 2 Comments

Screenshot of SWT Control Example

The Control Example is one of Eclipse SWT examples. I modified the tabs into dynamical loading tab so the example will work faster. You still need to wait about 8 seconds for the example to initialize besides the about 800+k of *.js downloads. Be ENOUGH patient, if you want to get a real tour of JavaScript version of SWT.

Of course the performance and the size of *.js will be optimized to an acceptable level in the future.

PS: J2S SWT Control Example on

And finally, after sometime of compressing and ripping out unused codes, after packed by dean edward’s packer, it’s about 250k of the size, and take about 5s to initialize. Considered acceptable when comparing to native Java SWT application.
Now, you can download the Control Example(*.zip 139k), and view the example locally.

J2S SWT Control Example

Posted in Screenshot, Sharing, SWT | Leave a comment

Ajax web pages

Another demo about Java2Script SWT. It also show the coming features of exporting static HTML codes from the J2S SWT window besides showing abilities of reading web pages in AJAX way.

or ajax-web-pages at

For a much faster view (HTML + CSS + a few lines of JS), please visit the exported static demo page

J2S with static HTML export support

Posted in Sharing, User Experience | 1 Comment

Position is Everything

Currently, J2S’ SWT widgets are on the way of being pixel-precise. And some certain pain things come up:

1. Different browsers

IE (IE6/5.5/5.0 and IE7, too many, I mainly work on IE6), Firefox (Different versions will render position in some slight differences), and Opera (Just check out to see if there are ugly looks in Opera 8+, no pixel-precise supports)

2. Native SWT implementation v.s. browser implementation

I have to debug into the native SWT implementation, and look for the native positions of different widgets, and then debug into the JavaScript’s SWT implementation to see if the positions match. And thanks a little, the JavaScript is actually the Java codes, so I can do refactors or navigate between codes easily by Eclipse. And J2S’ inner console also helps a lot for printing out those necessary values. The procedures is something like developing C codes for Java to call through JNI.

3. CSS layout v.s. JavaScript layout

The SWT implementation requires both CSS layout and JavaScript layout. CSS is powerful, but it’s also too complicated and it has its pitfalls on dynamical layout and it can not tell complicate rules. JavaScript’s layout is free to anything but requires extra CPU times on calculating positions. And the position is mixed up with all kinds of CSS styles, for example, different “font-size”s, different “border”s, different “margin”s, …

4. What about supporting different CSS templates

…en, big thing, until almost 90%+ SWT APIs are implemented. …

Actually J2S’ SWT will hide the above pains from SWT developers.

SWT developers or web application developers only need to develop the native SWT applications and then enable Java2Script compiler for the Eclipse project. Then the compiler will convert Java things into JavaScript. After packing the generated resources (image and css and javascript) up with the J2S SWT libraries. You will get your web applications. You won’t have the above pains, as those pains belong to J2S SWT team.
Here following is a testcase snapshot.

Native Win32 SWT window:
Native SWT Group and TabFolder

Converted J2S SWT window in IE6:

J2S' SWT Group and TabFolder

Posted in Java, JavaScript, Sharing | Leave a comment

WebCream – Java(Swing and AWT) to HTML converter

I came up with this interesting website today:

WebCream – Java to HTML converter providing automatic conversion of Swing and AWT to HTML

If you are interested about this, here is its demo page.

Its technology is dynamically conversion of SWING/AWT to HTML, and the GUI events will  be sent back the server to update the page (Something like ZK?). But Java2Script is pre-compiling all the GUI codes into JavaScript, and then all events are dealt in the Browser sides except those remote calls to server.

Posted in Sharing | 1 Comment

Early J2S’ Eclipse JFace Dialog

I spent sometimes on converting Eclipse’ JFace codes, and got something like TitleAreaDialog:

Early J2S JFace

But it took about 2+s(4s for IE6 on my machine) to do such layout (this time does not include the 1+s loading the *.js). It was just an experiment for things. And J2S JFace won’t be released in J2S 1.0.0.

Posted in Java2Script News, JavaScript, Sharing, User Experience | Comments Off on Early J2S’ Eclipse JFace Dialog