Category Archives: How To

Java2Script Introduces Simple RPC

Java2Script now introduces Simple RPC, which is aiming to help Java
developers balancing and debugging *local* and *remote* procedure calls for AJAX RIAs without knowledge of serialization and deserialization.

In Simple RPC, Java client have two modes: AJAX mode and local Java Thread mode (Default mode).
Here are some simple words describing the procedure of developing AJAX RIAs with Simple RPC.

1. Java developer can debug those procedure calls in local Java Thread mode with local Java SWT client.

2. After functions implemented, they can add a Java servlet wrapper (Java2Script provided), export all things as a JAR file and deploy it to Java EE container.

3. And now switch Java client to AJAX mode (set some static variables) and test whether the deployed servlet is OK or not.

4. If not correctly deployed or bugs popup, developers can switch back to local Java
Thread mode and do their debugging again.

5. In the end, use Java2Script compiler to compiler the Java SWT client into JavaScript RIA client and test it in browser.

For more details, please check out latest codes from SVN.

Posted in AJAX, How To, Java, Java2Script News, RPC, Simple RPC | 2 Comments

Java2Script Getting Started (for M3+)

Java2Script Getting Started (PDF)

It’s for the coming release of Java2Script 1.0.0 M3 and later release.

FAQ list is also to be created in the coming days.

Posted in How To, Java2Script News | 1 Comment

Test Driven Development by Java2Script

Now, Java2Script support JUnit for Test Driven Development(TDD) in developing RIA.

To do so, please set up the J2S development environment from SVN repository. If you would like to learn more details about JUnit support of J2S, you may need to checkout the project net.sf.j2s.java.junit.

After setup J2S environment, do your “Hello J2S World” examples for sure. And then create or import your testcases or testsuites. Make sure that your tests pass in Java’s JUnit test. And then “Run as…” -> “Java2Script Unit Test”, your tests will be run in console mode. You may come up with some failures in Java2Script mode even though all tests is passed in Java mode. For example, assertEquals(new Float(1.0).toString(), “1.0”) may result in comparing “1” with “1.0”, which will be considered as failures. Try to report bugs or try to avoid such buggy way.

Currently, JUnit tests over SWT are not supported yet.

Java2Script’s JUnit support will be in the next milestone release scheduled on middle of August.

Posted in How To, Java2Script News | 20 Comments

Hosting Update Manager on Sourceforge’s Mirrors

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

http://j2s.sourceforge.net/update/

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 Sourceforge.net.

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$ http://superb-east.dl.sourceforge.net/sourceforge/j2s/net.sf.j2s.$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.
Reference:

Plugging into SourceForge.net

http://www.eclipse.org/articles/Article-Plugging-into-SourceForge/sourceforge.html

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

J2S tutorial: Advanced Programming on J2S

Tutorial of J2S in Eclipse (7): Advanced Programming on J2S — @j2s* and others

josson smith
May 17, 2006
This article will describe more details on using Java2Script Pacemaker, including writing and debuging native JavaScript. Developer will learn how to debug and optimize their web applications beside the level of Java but also in level of JavaScript. This article aims those advanced Java2Script users.

Posted in How To, Java2Script News | 2 Comments

Setup Java2Script Environment from Subversion Repository

Setup Java2Script Environment from Subversion Repository

Brief steps:

  1. Install Eclipse and Subclipse
  2. Checkout sources from SVN https://svn.sourceforge.net/svnroot/j2s/sources.
  3. Export projects as “Deployable plug-ins and fragments”
  4. Exit Eclipse and enhance JDT Core Jar
  5. Restart Eclipse and rebuild “net.sf.j2s.java.core” and “net.sf.j2s.java.org.eclipse.swt”
  6. Checkout tests from SVN https://svn.sourceforge.net/svnroot/j2s/tests and make tests

Details steps

Posted in How To, Java2Script News | 2 Comments