RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Java SE 6 First Impressions: A Desktop Winner

A veteran Java developer takes the Java Standard Edition 6 beta for a test drive and declares it has the potential to be revolutionary to the desktop.

he recently released Java Standard Edition 6 (Java SE 6, a.k.a. Mustang) beta is feature complete and stable enough for mainstream evaluation. I downloaded and test drove the release in its first week of availability and came away particularly impressed with the new desktop features. Besides sporting the new naming convention for all Java platforms (the "2" has been dropped), it has been improved with many new features that are worth exploring. The improvements can be broken down into two categories: desktop and core.

The desktop improvements focus mainly on user interface (UI) performance and native OS desktop integration. The core improvements focus mainly on improving developer productivity and Java application management. Sun's Mustang team also put significant effort towards Web services support and security improvements.

Overall, whether you're an application developer, a system administrator, a tool vendor, or a security expert, Java SE 6 has something for you. This article presents some of the interesting new features I used in some more detail.

Core Features and Improvements

The Java core can be described as portions of Java (the language and its tools) that are fundamental to all other aspects of Java, from user interface APIs to server libraries. I describe the improvements to the Java core in Java SE 6 here, broken down by sub-category.

Developer Productivity
The new Java Compiler API allows Java source to be compiled from within a Java application. During compilation, the application has access to the library dependency information as formulated, along with any warnings, errors, and other messages that are generated. Although this feature did not seem like something I would use often, I quickly found new uses for it. For instance, I used it to quickly build the data-access layer for an application I had been building. The code I wrote generated and compiled the classes used to access the application's database tables. The end result was a JAR file that was generated, built, and deployed as part of the system's Ant scripts. The fact that the classes are compiled from within the application makes the code generation interactive—I can modify and build the classes iteratively.

To enable Java scripting, Java SE 6 supports JSR 223, 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.

For debugging, the Java Platform Debugger (JPDA) has been enhanced to detect deadlocks and generate stack traces for monitor objects that are locked. In addition, Java SE 6 adds support to allow agents to attach to a running JVM for diagnostic purposes.

Application Management
Java SE 6 enhances memory leak analysis and detection by including a full stack trace in the java.lang.OutOfMemory exception and generating a fatal error log when the heap is full. In addition, a new JVM option allows you to run a script when the heap is full.

Improvements to the JMX Monitoring API allow an application to send events when MBean attribute values (including those within complex types) pass specified thresholds.

For Solaris 10 users, the Hotspot JVM for Solaris provides hooks for the Solaris DTrace system debugging utility to track and display internal JVM activities, such as garbage collections, class loading, threads, locks, and so on. I was given a demo of this feature first-hand at JavaOne and was very impressed by the depth of debugging the DTrace system provides. As an application runs, DTrace allows you to stop the code anywhere, view all of the libraries loaded (not just the Java libraries, but all system libraries), and step right into the Solaris kernel—down to the hardware. Java's new support for this amazing tool makes available the world of system debugging. I can recall some times in the past when I received Solaris Signal-8 errors in the JVM; this feature would have saved me a lot of guessing.

Web Services
Java SE 6 includes a few APIs to support Web services. The XML Digital Signatures API allows you to secure Java-based Web services by performing cryptographic operations on XML data. The Java-XML Web Service (JAX-WS) 2.0 API updates the library formerly named JAX-RPC. Improvements to Java-XML Binding (JAXB) 2.0 include XML schema support and class binding to a schema. Lastly, the Streaming API for XML (STaX) provides a bi-directional API to read and write XML via a stream of events, including the ability to skip sections, and focus on sub-sections of documents.

Java SE 6's security offerings include GSS/Kerberos integration, Java Authentication and Authorization Service (JAAS) for LDAP authentication, and a security certificate request framework that allows Java applications to request secure certificates over a number of protocols.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date