views:

576

answers:

7

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?

+3  A: 

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.

tj111
objective-j compiles either at runtime or ahead of time. It's mostly javascript with a few extra constructs though.
cobbal
Objective-j is interpreted (by a javascript engine). It looks a bit weird for my tastes personally, but this http://280atlas.com/ is written in objective-j, and it looks awesome. Though i m sure a similar thing is possible in GWT.
Chii
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
+1  A: 
Joel Martinez
+2  A: 

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.

Chi
+3  A: 

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.

Ken
+3  A: 

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. :-)

system PAUSE
+1  A: 

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.

Fuse