The state of Java

 By Tim Anderson

Has Java become an irrelevance, or is it still an important development platform? Tim Anderson tests the water.

HardCopy Issue: 51 | Found In: Development | Published: 23/02/2011 | Last Revision: 23/02/2011

When Java first appeared on the scene in the 1990s, with its catch-phrase “write once, run anywhere”, it was a breath of fresh air, bringing new ideas to an industry that had become somewhat stagnant. Two decades later and the view is rather different – particularly since Oracle acquired Sun Microsystems in April 2009, marking the beginning of a period of disruption for what is now known as Oracle Java. Some members of the Java Community Process (JCP), a cross-industry group which oversees the Java specification, perceived that Oracle wanted more control over Java than Sun had exerted. JCP Member Stephen Colebourne declared it a “Great war of Java”, and another member, Doug Lea, stood down declaring that “the JCP is no longer a credible specification and standards body;” it had become “an approval body for Oracle-backed initiatives.” Other issues included Oracle’s refusal to allow Apache’s Harmony project (an open source implementation of Java) to use the official Java Compatibility Kit (JCK). There was also Oracle’s lawsuit against Google over alleged breach of copyright in the Android SDK and the Dalvik virtual machine. IBM abandoned the Harmony project, despite having been its biggest contributor, and announced it was siding with Oracle and investing in the official Open JDK instead. The 2010 JavaOne conference in San Francisco was held in the shadow of Oracle OpenWorld, and felt like a sideshow to the main event. In the meantime, Java lost ground in the platform wars. On mobile, the official implementation of Java has not kept pace; there is no Java on Apple’s iOS for iPhone and iPad, while Google Android uses its own virtual machine. Apple has also deprecated Java on its desktop version of OS X. JavaFX, which was meant to compete with Flash and Silverlight as a platform for Rich Internet Applications, has made little impact, and the JavaFX scripting language is to be deprecated. It is also widely felt that the Java language has fallen behind alternatives like C# from Microsoft. For example, C# has supported Lambda expressions since version 3.0 in 2007; Java will not get this until JDK 8.0 in 2012. It sounds bad; but how much does this impact developers building applications? It may be that under Oracle’s stewardship Java is in some respects less open than before, but tighter corporate control might actually improve one of Java’s deficiencies, namely its slow pace of evolution. Java 6 came out in 2006, but we are still waiting for Java 7. Furthermore the essential Java proposition, including the free JDK (Java Development Kit) and JRE (Java Runtime Environment) and the open source OpenJDK, remains as-is under Oracle.

Eclipse Helios screenshot
Eclipse Helios is the current release of this important developer platform.

Mike Milinkovitch, Executive Director of the Eclipse Foundation which builds an open tools platform for Java, posted his view of the “flurry of despair around Java and the JCP”: “I believe that Java and the JCP are doing just fine and are here to stay. Despite some short-term growing pains, they are both in much better shape than they were under Sun’s stewardship over the past couple of years. In fact, I would go so far as to say that in terms of real, tangible progress, this past month has been the best for Java in the past three years.” Dimitry Jemerov, developer of IntelliJ IDEA at JetBrains, told me: “The JVM remains to be one of the best virtual machines from the technical point of view. Java the language is getting a little stale, but Oracle has a clear plan to address the weakest area of the language with Project Lambda. Java in mobile is Android, and Android is not weak at all at the moment... While Oracle’s actions regarding Java on the legal side [the Google lawsuit and the Harmony TCK situation] are hardly positive, on the technical side a number of very good things have happened under the Oracle leadership. We’ve now got a clear and believable roadmap for the JDK; Java on the Mac will now be open-source and controlled by Oracle, which is far more interested in keeping Java working and up-to-date compared to Apple; and JavaFX is going to turn, when the version 2.0 is released, from a dead end resource sucker project into a set of distinct technologies of great immediate usefulness to many Java developers. “From our point of view, the Java ecosystem remains healthy and vibrant, and the net effect of Oracle’s stewardship is positive rather than negative. Moreover, the demand for our Java development tools is now as strong as ever.” Another industry trend working in Java’s favour is cloud computing. VMware acquired SpringSource in 2009, and since then has worked to combine its virtualisation platform with the Spring Java application framework to deliver platform as a service (PaaS). VMware has also partnered with SalesForce.com so that you can run Java applications on the Force.com cloud computing platform, calling the combined platform VMforce. One of the benefits of VMforce is that applications can scale automatically as demand varies. Amazon has recently announced a similar feature for its Elastic Compute Cloud (EC2). The engagingly-named Elastic Beanstalk is for applications running on the Apache Tomcat application server and will load-balances the application on one or more virtual servers, spinning instances up or down according to demand. Google’s App Engine also supports Java; and you can even run Tomcat and Java on Microsoft Windows Azure. Java is therefore an excellent choice if you have in mind cloud deployment, either now or in the future. Jemerov’s point about Android is also worth emphasising. Google Android is dominating the non-Apple Smartphone market, and a surge of Android tablets is also expected following plans announced by many vendors at the Consumer Electronics Show in Las Vegas in January. Android’s use of Java is controversial, in that its Dalvik virtual machine does not run Java bytecode. Nevertheless, the language of Dalvik is Java, and most Android application developers are Java developers.

Future developments

n order to speed delivery of the pieces that are ready, Oracle has announced two new Java releases in relatively quick succession: JDK 7 in 2011 and JDK 8 in 2012. These form the basis for Java SE (Standard Edition) and were approved by the JCP in December 2010. Java EE (Enterprise Edition) builds on Java SE, and current work includes a new Web services API focused on Web services using REST (Representational State Transfer).

JDK 7 (due July 2011)

JDK 7 will improve support for dynamically-typed languages with the new InvokeDynamic bytecode. This gives faster performance for languages like JRuby and Jython which run on the Java Virtual Machine (JVM). Performance of these languages should now be close to that of Java itself. Another change is in concurrency programming, including a new lightweight fork/join framework and a TransferQueue collection interface. Project Coin, also included in JDK 7, is a set of small language changes to improve productivity. The list includes:
• Strings allowed in switch conditions.
• Binary integral literals, and underscores in numeric literals, so you can write:
mask = 0b1100
or
mask = 0b1111_1111_0000
• Improved exception handling with multi-catch and more precise rethrow.
• Improved type inference when creating generic instances, so you can write the following and have the compiler work out that the ‘<>’ on the right represents the String type:
Foo foo = new Foo<>();
• Try with resources, closing resources automatically at the end of the block.
There is also an update to Unicode 6.0, new I/O and networking APIs, and upgrades to JDBC for database access and to the XML libraries. For desktop applications, there is stronger graphics support with a new graphics pipeline for Java 2D, translucent and shaped windows, and a new look and feel for Swing called Nimbus.

JavaFX 2.0 (due late 2011)

JavaFX 2.0 is intended to make Java competitive as a rich client, following a shaky start with JavaFX 1.0. JavaFX Script will no longer be needed, with all JavaFX APIs available to Java. There are a large number of improvements planned, including stronger and more concise multi-threading, full accessibility support, faster startup, and hardware-accelerated graphics based on a new pipeline codenamed Prism. There will also be a new media stack for audio and video, including full screen video. HTML 5 content is supported within the new WebView scene graph node.

JDK 8 (due late 2012)

JDK 8 includes updates originally promised for JDK 7, but which were delayed. The big one here is Lambda expressions, which are important for concurrent programming as well as for developer productivity. Further pieces of Project Coin will be implemented including parallel arrays. Project Jigsaw is a module system to simplify the building and packaging of applications – no more classpath!

Tooling up

One of Java’s attractions is the availability of several excellent IDEs in both free and commercial editions.

Amazon's Elastic Beanstalk screenshot
Currently supporting Java applications only, Amazon’s Elastic Beanstalk scales automatically on demand.

The most widely used is Eclipse, though this can be confusing as Eclipse is both a generic open development platform and, when combined with the Java IDE package, a strong Java IDE in its own right. Eclipse is in a constant state of flux, with hundreds of projects in varying stages of development, some for Java and some for other languages such as PHP. In order to mitigate the confusion, Eclipse creates a compatible bundle of key projects each summer. The current release is called Helios, and the 2011 release is called Indigo. Although Eclipse is capable on its own, in a commercial development team it can be tricky to ensure consistency between different Eclipse installations. Embarcadero’s JBuilder is built on Eclipse, but is a tuned package that also adds unique features. JBuilder-specific features include UML 2.0 diagramming with live code synchronisation, a visual designer for Enterprise Javabeans (EJB), application factories, TeamInsight collaboration, and a Swing Designer for user interface construction. Another strong Java IDE is the free and open source NetBeans. This is the closest thing to an official Java IDE and stays close to new releases of the JDK. Although less broadly adopted than Eclipse, NetBeans also supports other languages including PHP, Ruby, JavaScript and C/C++.

IntelliJ Idea screenshot
IntelliJ Idea is known for its strong refactoring support.

IntelliJ IDEA from JetBrains is another option, available both as a free community edition and as a commercial product. The paid-for version adds support for important technologies including Java EE, Spring, Struts and Hibernate, as well as additional languages such as Adobe ActionScript, PHP, Python and Ruby. IntelliJ IDEA is known for its array of developer productivity features, including an intelligent editor and numerous refactorings. IntelliJ IDEA supports modules that get you started with a variety of project types including basic Java, Maven, Android, Grails, J2ME, Ruby, Python and Adobe Flex. IBM and Oracle also have IDEs which may make particular sense if you are building on application server or database products from those companies.

Java add-ons

The Java platform is so extensive that singling out individual products is a challenge. Aside from desktop applications, most Java projects need an application server, with common choices being the free Apache Tomcat, IBM WebSphere, Oracle Application Server, Oracle WebLogic or RedHat JBoss.

When to use Java

The question of when to use Java is one that often answers itself, perhaps because there is already a Java-based infrastructure on which to deploy, or because you need to integrate with other Java applications and continuing with the same language is the most friction-free approach.

Similarly, if you want to code for Android the choice is Java or C/C++, and that decision will be based on factors like performance requirements and available skills, rather than the latest pronouncements of Oracle, Apache or the JCP. If you want to code for Apple iOS, on the other hand, Java is not even a choice; while for Mac desktop applications there are reasons to use native code instead. Java applications, for example, are not eligible for inclusion in the new Mac App Store.

Spring, from VMware, is a popular application framework that is supported by the Eclipse-based SpringSource Tool Suite. One of the challenges for Java developers is integration with the Microsoft platform. JNetDirect products include JSQLConnect, a JDBC driver for Microsoft SQL Server which now supports versions up to SQL Server 2008 R2. You can also obtain commercial components and libraries for Java. For example, Aspose has components for document processing with word processor, spreadsheet and PDF formats, a barcode add-on, and a charting and reporting library. SoftwareFX has a range of charting components for Java, while SAP Crystal Reports lets you embed reports into Java applications whether desktop or Web-based. It is true that the politics and community around Java is in some turmoil, and that the core Java language has fallen behind languages like C# in some respects. On the other hand it is also true that the level of support, activity and opportunity around Java remains high, and there are many individual projects that have the energy and momentum that may seem lacking in the official core releases. The bottom line is that Java remains among the most important languages and platforms in the industry, especially for server applications, and that is not going to change soon.

Share and Bookmark  

Comments

Be the first to comment about this article...

Leave a comment

You must login to place comments.