Shaun Abram
Technology and Leadership Blog
Java 6
What’s new in Java 6?
Version 6 of the Java Platform, Standard Edition (Java SE), was released for general availability in December 2006 and at time of writing, the latest release is Java SE 6 Update 10 Beta.
I’ve tried to summarise some of it’s key offerings below…
Use of @Override for interface methods
You can now use the @Override annotation to mark when a method implements an interface. Do it to allow the compiler to check you are actually overriding a method when you think you are. Prior to Java6, @Override could only be used for overriding methods in a subclass. Although not a major change, it is one that you may run into from a Java5/6 compatibility perspective, hence it being first in the list.
Script integration
Java 6 comes with built in support for scripting languages such as PHP, Ruby, JavaScript, and Python. You can
- embed scripts directly into your Java applications using the ScriptEngine class
- invoke Java classes from within your scripts using the importPackage() function
- invoke a function by name within a script by using the Invocable interface
See more at
Java Scripting Programmer’s Guide (java.sun.com)
Scripting in Java 6 (onjava.com)
JDBC Enhancements
Java 6 comes with a number of new JDBC features including Java DB, an integrated distribution of the Apache Derby (formerly IBM Cloudscape) database.
The built-in database lets developers easily set up and run fast-running unit tests against a real database, without the hassle of setting up and managing a test database environment.
Also, you no longer need to explicitly load the JDBC class.
e.g. you don’t need a line such as
Class.forName(“oracle.jdbc.driver.OracleDriver”);
Instead, the driver will be loaded whenever you obtain a new Connection from the DriverManager class, e.g.:
Connection conn = DriverManager.getConnection(“jdbc:derby:TestDB”);
System Tray
The system tray goes a long way in developing Java applications that look and behave more like native applications. It was originally part of the JDesktop Integration Components (JDIC) and allows you to add a menu on the user desktop’s user tray.
See more at
New System Tray Functionality in Java SE 6 (java.sun.com)
Monitoring and Management
The Java Monitoring and Management Console, or JConsole, which first appeared in Java 5, is a graphical monitoring tool based on JMX. It provides a very complete view of the performance and resource consumption of Java applications.
JConsole has been enhanced in Java 6 in several ways, making it both easier to use and more powerful. The graphical look has been improved; you can now monitor several applications in the same JConsole instance, and the summary screen has been redesigned. It now displays a graphical dashboard of the key statistics. You also can now export any graph data in CSV form for further analysis in a spreadsheet.
Java 6 also comes with sophisticated thread-management and monitoring features as well. The Java 6 VM can now monitor applications for deadlocked threads involving object monitors and java.util.concurrent ownable synchronizers.
Managing the File System
Java 6 gives you more control over your local file system. For example, you can now use the java.io.File class to
- find out how much free space is left on your hard drive
- set the readable, writable, and executable flags on files in your local file system (as you would with the Unix chmod command)
And much more…
Java 6 offers many other new features too, including
- support for JAX-WS Web services and JAXB 2.0 XML binding
- improvements in the Swing and AWT APIs
- language enhancements such as sorted sets and maps with bidirectional navigation
See more at
What’s Cool in Java SE 6 (devx.com)