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


Tiger Stripes: Get Ready to Purr Over J2SE 5.0 : Page 3

Tiger, the next version of the J2SE SDK, features language improvements, better performance, better debugging and management, near-native GUI representation, and much more. We grab the Tiger by the tail and take a good look at what it has to offer.

Scalability and Performance
There are a number of areas where Sun has been tweaking Java to improve performance, emphasizing startup time and memory footprint. It has also introduced the concept of class data sharing in the JVM, where read-only data may be shared between multiple running JVMs, which is great for programs that use multiple JVMs, but it also means that many core JVM classes are pre-loaded by the first instance of the JVM.

Monitoring and Manageability
Java Management Extensions (JMX) evolved from JSR-003. They are tools that allow the JVM and your applications to be monitored using the JMX Remote Interface (JMXRI, JSR-160) or industry standard SNMP tools. These come with a full API so that you can inspect management characteristics such as the amount of free memory or the CPU load within your own applications. For example, the code snippet below shows how you can use the MemoryPoolMXBean type from the management API to output information about memory usage.
import java.lang.management.*;
import java.util.*;

public class MemTest {
  public static void main(String args[]) {
    List<MemoryPoolMXBean> pools =       
    for (MemoryPoolMXBean p: pools) {
      System.out.println("Memory type="+p.getType()+" Memory  
Another useful API class set is one which helps you get around stack traces. It can be very awkward to get a stack trace if no console window is readily available. Anybody who has tried to figure out why a problem is occurring on a distant customer site while the application works nicely on your development platform will know exactly what I mean. Tiger gives you a getStackTrace and a getAllStackTraces class that will allow you to roll your own output logger for handling errors or other functionality.

Improved Desktop
Java has been much maligned as a platform for building desktop applications. With the JVM wars of the past behind us and with new initiatives such as SWT giving developers better methodologies for success, Java on the desktop is making a comeback. The emergence of Linux as a contender to Windows for the corporate desktop has helped to fuel this trend.

It should come as no surprise then that the Java SDK is evolving, and its native look and feel themes are getting closer and closer to their Windows-native counterparts. As an example, Figure 4 shows the Windows common dialog box, rendered in both J2SE and Microsoft Office 2003. Can you spot which side is which?

Figure 4. Which Is Which? : One of these dialog boxes comes from Java/Swing and the other is native Windows.
The eagle-eyed among you will see that the Java one is on the left. The Java icon in the top right-hand corner is the only dead giveaway. Other than a few differences with the icons and slightly different shades of color, there isn't much to distinguish between the native GUI and the Java one. Incidentally, the Java common dialog is much faster when you have a machine that has network shares, as it doesn't attempt to preauthenticate against those shares before you can do anything. So, in a case such as this one where you are looking for files on your hard drive, Java is orders of magnitude faster than the standard Windows dialog used by Microsoft Office!

It's been a long time coming, but the new version of the Java SDK will be worth the wait. Language enhancements mostly make your code more readable, but more importantly bring more compiler checking into common tasks, reducing run-time errors in typical code. While some of the language enhancements are making Java look more C++ like and therefore a little more complicated, on the whole it appears to succeed in giving power without sacrificing readability and learning curve. Features such as auto-boxing are great for new developers in particular.

Add to this the performance enhancements, namely the loading and memory management of the VM, as well as the manageability extensions and it looks like a run-time winner too. The biggest challenge to the widespread adoption of the SE, particularly for enterprise users, is the poisoned well of desktop VM incompatibility and reduced user experience. This came about from incompatibilities between VMs from Microsoft and Sun and from the lowest-common-denominator approach of the original Java 1.0. For example, under Java 1.0 only one mouse button was supported because the Macintosh only supported one button, and should the VM support more than one, the portability of applications would be lost. This led to a reduced experience relative to writing in native code. Put simply, J2SE 1.5 is going to give current Java developers much to be grateful for and will ensure the language remains competitive with C#, C++, and any other modern-day programming languages.

Laurence Moroney is a freelance enterprise architect who specializes in designing and implementing service-oriented applications and environments using .NET, J2EE, or (preferably) both. He has authored books on .NET and Web services security, and more than 30 professional articles. A former Wall Street architect, and security analyst, he also dabbles in journalism, reporting for professional sports. You can find his blog at http://www.philotic.com/blog.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date