Alex Rivera | Logout

Why do we need other JVM languages

Asked 2008-09-17T16:30:50.770
25

I see here that there are a load of languages aside from Java that run on the JVM. I'm a bit confused about the whole concept of other languages running in the JVM. So:

What is the advantage in having other languages for the JVM?

What is required (in high level terms) to write a language/compiler for the JVM?

How do you write/compile/run code in a language (other than Java) in the JVM?


EDIT: There were 3 follow up questions (originally comments) that were answered in the accepted answer. They are reprinted here for legibility:

How would an app written in, say, JPython, interact with a Java app?

Also, Can that JPython application use any of the JDK functions/objects??

What if it was Jaskell code, would the fact that it is a functional language not make it incompatible with the JDK?

Edit
Report

1 Answer

1

The .NET languages are more for show than actual usefulness. Each language has been so butchered, that they're all C# with a new face.

There are a variety of reasons to provide alternative languages for the Java VM:

  • The JVM is multiplatform. Any language ported to the JVM gets that as a free bonus.
  • There is quite a bit of legacy code out there. Antiquated engines like ColdFusion perform better while offering customers the ability to slowly phase their applications from the legacy solution to the modern solution.
  • Certain forms of scripting are better suited to rapid development. JavaFX, for example, is designed with rapid Graphical development in mind. In this way it competes with engines like DarkBasic. (Processing is another player in this space.)
  • Scripting environments can offer control. For example, an application may wish to expose a VBA-like environment to the user without exposing the underlying Java APIs. Using an engine like Rhino can provide an environment that supports quick and dirty coding in a carefully controlled sandbox.
  • Interpreted scripts mean that there's no need to recompile anything. No need to recompile translates into a more dynamic environment. e.g. Despite OpenOffice's use of Java as a "scripting language", Java sucks for that use. The user has to go through all kinds of recompile/reload gyrations that are unnecessary in a dynamic scripting environment like Javascript.
  • Which brings me to another point. Scripting engines can be more easily stopped and reloaded without stopping and reloading the entire JVM. This increases the utility of the scripting language as the environment can be reset at any time.
answered 2008-09-17T16:49:03.097

Your Answer