Many modern programming languages (Scala, Erlang, Clojure, etc.) are targeting the JVM. What are the main reasons behind that decision?

  • JVM's maturity?
  • Portability?
  • Because JVM simply exists, and the language designers were not willing to write a new VM/interpreter?

5 Answers 5


Erlang is a standalone language but there is work being done on Erjang which is targeting the JVM. You're right that Scala and Clojure are targeting the JVM, and there are versions of Ruby and Python targeting the JVM as well (JRuby, Jython).

Yes, the JVM is a very mature platform and modern JVMs are able to optimize code and compile it on-demand to the host's native code for increased performance.

Yes, portability. Compiled Scala, Clojure, etc can be packaged using standard tools and distributed to any system that has a JVM (of a suitable version level).

Yes, the JVM means new languages "only" have to write a compiler to bytecode (and any supporting libraries they want to provide). They don't have to write a new runtime (which is what Erlang, Ruby, Python, JavaScript etc have all done in the past).

But I think you've missed one of the biggest benefits of the JVM: the huge ecosystem of libraries - both the Java standard library and the vast array of third party libraries are accessible to any language that targets the JVM.


I'd say it's 10% option (a), 70% option (b) and 20% option (c).

Writing a reliable virtual machine is hard. It's a big part of why Perl6 was 10 years late - it runs on a register-based VM unlike the common ones and had to be written essentially from scratch). Also, you can leverage not just the VM but also the standard libraries, which are huge in Java.

But the major factor is probably that it is already on every conceivable platform - the direct competitor .NET is, in practice, Windows-only. And when you have already decided not to do your own VM, reusing the one that is most available is a no-brainer.

  • I'm not an expert, but the Perl6 example sounds fishy - sure, register-based VMs are probably harder than stack-based ones, but nearly as well-understood and can still a rather simple interpreter for a simple bytecode language (look at Lua 5!). I think most of the delay is because (1) they didn't exactly churn out a complete spec within 5 months and (2) Perl is a very complex language to implement, even moreso with some the new features. Still a good answer.
    – user7043
    Commented Oct 5, 2011 at 18:31
  • The VM is rather easy (see lua). But writing a good JIT for a language is very hard. And these days, a languages without a JIT will be one of the worst performing languages available. That being said, sometimes writing a JIT for a language can result in incredible performance boosts. PyPy and LuaJIT are tracing JITs that result in self-optimizing code. The output from these JITs out perform JPython by a large margin. But they are also programs that very, very few people fully understand. Commented Oct 12, 2011 at 13:14

An interesting historical footnote is that Martin Odersky, the creator of Scala was also the creator of a short-lived language called Pizza that was one of the first non-Java languages to target the JVM. It's implementation of generics was eventually incorporated in Java 5. You can read his interview on the origins of scala to get some insight into why he likes targeting the JVM.

  • 1
    I am not sure if pioneering Java's version of generics is something to brag about, but then again for the time it was pretty impressive.
    – maple_shaft
    Commented Oct 5, 2011 at 19:05
  • Interesting, I thought Pizza's generics were solved better than in Java :-0
    – DaveFar
    Commented Oct 5, 2011 at 21:12
  • 2
    @maple_shaft, the problem is the design decision that the generics information is not present at runtime. A direct consequence of Suns great attention to backward compatability.
    – user1249
    Commented Oct 5, 2011 at 21:53

You forget to add another reason:

  • It's what language designers know.

Significant bits of education (and, as a result, early work experience) for potential language designers are now being done in Java. See, for example, Wikipedia's history for Scala. As more and more developers are moving to using Javascript and its VM, you'll see newer languages running on that VM instead.

  • 5
    I'm going on make a bold claim here and say that people who have created languages successful today didn't go to college 5 or 10 years ago and learned programming in Java. For example, Martin Odersky got his PhD in 1989 and Rick Hickey (Clojure) has 20 years of work experience according to Wikipedia. In fact, I'd be surprised if the majority of serious language designers were mentally locked into a single language or platform.
    – user7043
    Commented Oct 5, 2011 at 18:38
  • No, they went to university 20 years ago, and started working when the majority of available jobs for language designers were with companies working on creating Java virtual machines. In the same vein, the people working on language design today, got their phds sometime in the past 10 years, and most likely did their first bits of work getting the current Javascript vms up to par. Commented Oct 5, 2011 at 18:41
  • I think delnan is correct that you don't move from no practical experience into a language design position. As for the JVM, most designers had long practical experience in Smalltalk.
    – DaveFar
    Commented Oct 5, 2011 at 21:15
  • @delnan: I'd suggest that anybody mentally locked into a single language can't design a worthwhile new language. When all I knew was BASIC, I didn't understand what I was missing, and couldn't come up with any good improvements. Commented Oct 5, 2011 at 21:52

My estimation's:

  • 20% JVM's maturity
  • 50% Portability, especially of all the Java-libraries already available for the JVM
  • 30% Because JVM simply exists, and the language designers were not willing didn't have the time to write a new VM/interpreter.

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