Skip to main content

A Brief Look at Java SE 7 Non-Java Language Support

Posted by editor on March 25, 2011 at 12:34 PM PDT

At the recent OTN Java Developer Day in Boston (US), during his presentation "Java SE - The road forward, 2011 edition," Danny Coward took some time to talk about the new scripting features in Java SE 7. In a little demonstration, he showed a code snippet that begins with import javax.script.x and continues with creating a script engine (for example, for Javascript). The objective of the new API, Danny said, is to let other languages use the Java Runtime.

This is more commonly talked about as InvokeDynamic, which is JSR 292. The Java SE 7 Developer Preview page lists JSR 292 at the top of the list of new features and enhancements for Java SE 7. That entry links to Java Virtual Machine Support for Non-Java Languages, which provides an overview and examples.

So, what does invokedynamic provide?

The invokedynamic instruction introduced in Java SE 7 simplifies the implementation of dynamically typed languages on the JVM. It can also potentially improve the performance of these languages.

There are three steps involved:

The discussion in the documentation describes what all of this means and provides basic examples.

As you'd expect, there is some complexity to linking up code from dynamically linked languages with Java. But the benefit of the new invokedynamic capability, in my view, is that it raises the work in accomplishing this out of the low-level "mud" (you'll probably know what I mean by this, if you've done work in the past trying to seemlessly link code from very different languages) by providing a framework that can be applied to a great many different situations. Once you become comfortable with using the invokedynamic capability, you'll be able to apply it to new situations and new tasks, and achieve integration of Java and non-Java code bases with much greated efficiency that was possible before. At least, that's my take on the benefit of invokedynamic.

If you'd like more information, consider visiting the OpenJDK Da Vinci Machine Project site, which provides links to related articles, presentations, and other documentation materials.


Poll

Our current java.net poll asks How would you rate the responsiveness and ease-of-use of the bugs.sun.com website? Voting ends Monday.


Spotlights

Our latest java.net href="http://www.java.net/archive/spotlight">Spotlight is Eric S Chan's new article,
OpenICOM: A JPA Framework for Integrated Collaboration Environments, Part 1
-

This article is the first part of the three parts series to present a new project http://java.net/projects/open-icom in java.net to incubate a JPA framework for developing integrated collaboration environments. The first part explains the advantages of the JPA programming model, which embodies the design patterns that are well-suited for managing...

We're also still featuring Adam Bateman's JDK 7 nearing the endgame -

Just a reminder that JDK 7 is nearing the endgame and now is the right time to grab the latest JDK 7 build and give it a test drive. Once it goes beyond the end of March then the release will start to get locked down and it will get harder to get fixes or changes in (don't leave it too late). The important thing is to make sure that your existing code works well...


Java News

Here are the stories we've recently featured in our Java news section.


Subscriptions and Archives: You can subscribe to this blog using the java.net Editor's Blog Feed. You can also subscribe to the Java Today RSS feed and the java.net blogs feed. You can find historical archives of what has appeared the front page of java.net in the java.net home page archive.

-- Kevin Farnham

Twitter: @kevin_farnham