Java to Javascript Converter

Much of today's application development is happening in the browser and it's a big advantage to use the same language for client/server applications. To address this need, StrataCode offers a robust conversion of Java to Javascript. Unlike other implementations, StrataCode generates readable, debuggable javascript that is close to what a Java programmer would have written anyway (i.e. using the same names, the same order in the file, formatted, etc).

Since layers can run on the client, server or both, StrataCode supports isomorphic Java. Web page requests generate HTML on the server so the browser draws it as quickly as possible. The page then begins loading the javascript version of the code to perform any dynamic HTML updates. You write the code once, StrataCode generates the client and server versions.

StrataCode provides schtml and scss formats which extend html and css to allow dynamic updates. Some pages are fully reactive - i.e. generated entirely from data binding, and others generate HTML from a mix of data binding and code. If necessary, you can mix Java and HTML using the full power of Java. You have inheritance, layers, data binding, tag macros, and java when you need it.

The test suite contains over 50K lines of unmodified Java (i.e. no working around translation bugs). This includes about 15K lines of unmodified Java code from the Apache java.lang and java.util packages. We do not have Java 8 libraries for JS yet but theoretically lambda expressions and more should work in JS, possibly with some bugs to fix.

No optimization has been done yet to remove unused code though we can make improvements to download size with some work. There's a flexible library system and the class emulation is higher than other Java to JS implementations so footprint is reduced that way.

Currently, your entire JS app is downloaded after the page is rendered but we will at some point be able to specify that different layers are loaded later. For large client applications, you'll be able to start interacting with the app while additional features are being downloaded.

Read more in the documentation.

Here's an example. This java implementation of selection sort:

file: example/simple/
public class SortTest {
   public static void doSort(int[] arr) {
      for (int i = 0; i < arr.length - 1; i++) {
         int index = i;
         for (int j = i + 1; j < arr.length; j++) {
            if (arr[j] < arr[index])
               index = j;
         int toMove = arr[index]; 
         arr[index] = arr[i];
         arr[i] = toMove;
   public static void main(String args[]) {
       int[] arr = {5, 8, 0, 13, 21, 1, 2, 34, 3, 1}; 

       for (int i : arr) {
           System.out.print(i + ", ");
is converted to this javascript:
file: example/simple/js/types/example_simple_SortTest.js
// Generated JS from Java: example.simple.SortTest -----
function example_simple_SortTest() {;

var _c, example_simple_SortTest_c = _c = sc_newClass("example.simple.SortTest", example_simple_SortTest, jv_Object, null);

_c.doSort = function (arr)  {
   for (var i = 0; i < arr.length - 1; i++) {
      var index = i;
      for (var j = i + 1; j < arr.length; j++) if (arr[j] < arr[index])
            index = j;
      var toMove = arr[index];
      arr[index] = arr[i];
      arr[i] = toMove;
_c.main = function (args)  {
   var arr =[5, 8, 0, 13, 21, 1, 2, 34, 3, 1];
      var _lv = arr;
      for (var _i = 0; _i < _lv.length; _i++) {
         var i = arr[_i];
         jv_System_c.out.print(i + ", ");