Categories
Uncategorized

Java SE 6 Released / Java 6's Script Engines

Sun announced the release of Java SE version 6 on Monday, and I'm still looking through its features in a half-interested sort of way. I've made a career (some people might say I've unmade one) out of avoiding Java development, as it seems to demand so much damned “preamble” to get anything done. The fact that Java requires you to declare a class just to write a “Hello World” program should be a warning; the defection of some of Java's bright lights to dynamic programming languages and the functional programming paradigm should tell you which way the wind is blowing. It's more truth than joke when people say that Java is the new COBOL.

That being said, COBOL still powers a number of applications out there; there's a decent chance that some bit of your financial life is being crunched by some COBOL routine running on big iron deep in the bowels of a data center. According to Wikipedia, George's ultimate masters — the Gartner Group — reported in 1997 that 80% of the world's business ran on COBOL with 180 billion lines of code in existence at the time; they estimated 5 billion lines of new COBOL code were being written annually.

The staying power of a language whose spec was written in 1960 should be some kind of indication of where Java is heading, longevity-wise. If Java lives as long as COBOL and continues releasing updates at the same pace, we should expect to see Java 20 in the mid-2030s.

Among the features in this latest release of Java:

  • Compiler API: You can stick a Java compiler inside your Java app, which could be good for on-the-fly code generation (which in turn might be good for data access layers on the fly, the way Rails does), or for other nifty little metaprogramming tricks that were available only to dynamic programming language folk.
  • Enhanced debugging, memory leak analysis and detection.
  • APIs to support web services: XML Digital Signatures API, The Java-XML Web Service. improvements to Java-XML Binding, Streaming API for XML.
  • Security: GSS/Kerberos integration, Java Authentication and Authorization Service for LDAP authentication and a security certificate request framework
  • A whole load of improvements meant for desktop apps, including:
    • A new API — java.awt.Desktop — whose aim is to make Java desktop apps “first-class citizens”, with awareness of things like default email and web clients as well as integration with common office apps.
    • Support for splash screens that can be displayed even before the JVM starts.
    • Improvements to JFC and Swing: leveraging of Windows API for a really native look-and-feel, enhancements to the layout managers, custimizable Swing drag-and-drop, true double-buffering.
    • New classes for system tray support.
    • Improved print support for JTable.
    • Improved text rendering, especially for antialiasing on LCD displays.
    • Enhanced support for internationalization.

Maybe it's me, but this new-found focus on desktop applications make me feel as if I've time-warped back to 1997. Reading this list, I was half-tempted to upgrade to one of those blazing-fast 300MHz Klamath Pentium boxes, hook it to one of those newfangled 56K modems and then go buy that new Block Rockin' Beats single by the Chemical Brothers at my local Tower Records.

Perhaps when Java 9 comes out (around 2012), it'll come with all sorts of cool Ajax APIs.

A ruby, Duke the java mascot and a python.

The feature I find interesting is the scripting framework, which is described in this DevX article as follows:

…a scripting framework that provides scripting language access to Java internals. You can locate scripting engines and invoke them to run scripts at runtime. The Scripting API allows you to provide Java support for the scripting language of your choice. In addition, the Web Scripting Framework allows script code to generate Web content within any Servlet container.

I assume this means that you could simply code in your preferred scripting language and run it on a JVM, or perhaps make your Java apps scriptable in over a dozen scripting languages — just plug in the appropriate scripting engine and you're off. Java SE 6 will ship with Rhino, the JavaScript script engine, and engines for other languages such as Ruby and Python are available for download from the Java Scripting Engines page.

Links: