11

I am using GWT, which includes a Java-to-JavaScript compiler. Before this project, targeting the JavaScript runtime from a different language hadn't occurred to me, and I'm enjoying the GWT experience.

A quick search revealed Java2Script as another Java-to-JavaScript solution. Are there any other mature compilers that target the JavaScript runtime?

1

9 Answers 9

11

List of languages that compile to JS

5

You also have Haxe. It features static, structural, strong and inferred typing; algebraic data types; lambda expressions with closure support; a module system and can compile not only to JavaScript but also Flash, C++, Neko, PHP. Java support is under development too.

4

Pyjamas compiles Python to JavaScript.

HotRuby runs Ruby source code under JavaScript and Flash.

Orto is (was?) a JVM implemented in JavaScript. (Original site is down; link is to a blog entry.)

The ZK framework, which likes to compare themselves favorably against GWT, uses Java and XML to generate JavaScript. (They claim that it takes far less code than GWT to do the same stuff.)

And I have heard it well-argued that jQuery is a separate language that happens to be implemented in, and run under, JavaScript. :-)

3

OpenLaszlo is on open source XML -> Javascript (technically DHTML, also can compile to Flash) compiler. I've played with it a little bit and it seemed interesting, although have never used it seriously (bad IDE support when I tried it).

Objective-j is a similar project that resembles objective-c, although runs as javascript (not sure if it compiles it or has a js interpreter). I don't know much about it, but do see posts about it on the Ajaxian from time to time.

3
  • objective-j compiles either at runtime or ahead of time. It's mostly javascript with a few extra constructs though.
    – cobbal
    Jun 10, 2009 at 14:50
  • Objective-j is interpreted (by a javascript engine). It looks a bit weird for my tastes personally, but this 280atlas.com is written in objective-j, and it looks awesome. Though i m sure a similar thing is possible in GWT.
    – Chii
    Jun 10, 2009 at 14:51
  • Objective-J code looks ugly. I hate Objective-C code as well so... OpenLaszio looks great actually, I might even try it some time.
    – the_drow
    Sep 16, 2009 at 0:39
3

Parenscript is "a translator from a small Lispy language to JavaScript". It's not Common Lisp -- it's mostly just Lisp syntax for Javascript, though for simple things you can write the same code to target both, if you're careful. I'm not sure I'd call it "mature", either.

2

While there are other products which compile to javascript (noted in the other comments), I believe that GWT is, by far, the most mature one out there, in terms of real-world usage. The simple fact that a number of Google's core applications use GWT (e.g.: the new adwords GUI, Google wave, etc) means you can have confidence the product is going to be maintained for at least the next few years, it isn't just going to fade away anytime soon.

Another thing to keep in mind is that GWT is far more than a java-to-javascript compiler, it also is an optimizing compiler, it has hosted mode, it is fully interoperable with native javascript, it does image bundling, it does code spliting in the new version, etc.

1
  • Google suspended Wave development less than 3 months after its public release, so in retrospect I'm not sure that was the best example of GWT's anticipated longevity. :-)
    – Ken
    Nov 25, 2010 at 20:38
1
1

The inventors of Clojure (a JVM based Lisp dialect) launched ClojureScript in mid-2011. ClojureScript compiles Clojure source code into JavaScript, making use of the Google Closure compiler and the Closure framework. ClojureScript code can run both in the browser client, or on node.js servers.

0

Here's a shameless plug for a project I started and am continuing to develop: scxml-js, a Statecharts-to-JavaScript compiler

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.