Friday, July 29, 2011

Java JDK 7 / JRE 7 Final Released : Java Runtime Environment and Development Kit, Five Years in the Making!

Java 7 / JRE 7 (Java Runtime Environment 7) and Java Final Released

Java 7.0 : A Five-Year Wait, Finally Released

Seriously folks, it has been a whopping 5 years since work was started on the successor to Java 6. In that time, Sun Microsystems was purchased by Oracle Corporation, and so much has changed! Think about where the web was 5 years ago and where devices were: you didn't have Android or iPad presence to consider and HTML5 was also nowhere to be found, Google's Chrome Browser was also not around. But, while Java sat in an apparent state of near-dormancy (with regards to major development milestones), the rest of the web changed and JavaScript/HTML5 came into existence and all those devices, browsers, and other technology really took off.

I am one of those developers that kept looking at Java every year or so and contemplating using Java as a software development language / framework, but ultimately choosing each time to NOT go with Java for the simple reason that it looked stagnant and lacking. There were so many missing features that I considered a requirement for any software development language, and the promise of those features coming in Java 7 just continually kept taking more and more time to become reality. I gave up on Java 7 repeatedly with my last major evaluation of the state of Java 7 taking place in mid-2010, where I again passed on it in favor of alternative technologies.

But, yesterday without much fanfare, Oracle finally released the "final" (or should I say "initial") version of Java JRE 7. And, it is not too surprising they didn't make a big deal out of the release, as (from what I observed over the past few years), the only way they could even achieve this 5-year-release milestone was by peeling away features that had been planned for this release (and which are now postponed or will never happen). But, regardless, the JRE 7 / Java 7 release is now available.

What's New in Java 7 / JRE 7 / JDK 7 / Java SE 7

OK, the first thing I can not stand about Java is all this "JRE, SE, EE, JDK, etc." stuff. For god sakes... why so many names? There is the Java Runtime Environment (JRE 7) and the Java Development Kit (JDK 7) and then the confusing "SE" nomenclature (Java Platform, Standard Edition) and "EE" (Java Platform Enterprise Edition), and all the other junk like Javabeans and Enterprise JavaBeans and on and on.

This alone says a lot about what I consider Java: a mess. As much as I am no huge fan of Microsoft's bloated DotNet framework, I consider it a huge improvement (and much simpler to deploy applications based on) over the Java counterpart(s).

Summary of New Features in Java 7

At a very high level, Java 7 includes new features like: some changes to the Java language that should lead to developer productivity improvements; a new Filesystem API and support for asynchronous I/O and even built-in zip-file handling (Java I/O features the new NIO 2, Non-blocking I/O 2); some updates to portions of the framework for multicore performance (like in the fork/join area); improved support for dynamic and script languages; security updates and improvements; and other stuff

Details of New Features in Java 7

I now come back to that whole JRE, JDK, SE, etc. stuff... as I have to tackle the What's New in Java 7 by each of these sub-categories. And, then comes how to even quickly assess the new features in Java 7 when Oracle puts out a page that clearly targets "techno geeks" with terms like RFE, without them even taking time on their web-page to define or explain what an "RFE" is!

So, let me start there, an RFE in the context of Java improvements/bug-fixes/feature-requests is:
Java RFE: Request For Enhancement — i.e., a formal request to Sun (well, Oracle now) to enhance the Java language or the related libraries.
People have been submitting these RFE's for years, and if they are lucky, and enough people really push for something, the RFE may be implemented in a future release of the Java JRE/JDK, etc.  In this case, the Java 7 release includes enhancements that address some rather significant and long-standing RFEs (including a few that kept me from ever commiting to developing any substantial application using Java).

What's New in Java SE 7 and Java JDK 7

Changes to Java SE 7 include changes to the Java language, the definition of the Java Virtual Machine (JVM), or the Java SE API Specification. Changes to JDK 7 includes changes to javac, to HotSpot (and related tools), and to the implementation of the Java SE 7 API. Wow, I already feel like I am going in circles where the JDK 7 changes reference the SE 7 changes and back-n-forth. Ughhhh.

Well, regardless of the absolute mess (in my view) that Java is in, in terms of naming and functional areas of the technology, here are some of the more substantial items in this release (I focus first on items most important to me as a software-developer looking at Java for creating custom software applications):
  • Java Programming Language Enhancements : What could be more important to Software Developers? (well, a lot actually,... a great language alone means little without a framework that supports common needs like easy file-I/O, which thankfully is also addressed in Java 7). There are some nice improvements to the programming language worth mentioning here,including:
    • Strings in switch Statements : I wish all languages could standardize on supporting this; to me it only makes sense to be able to base a case (switch) statement's execution-branch evaluations on anything, String class or otherwise. Nice!
    • Type Inference for Generic Instance Creation : I find this new language feature to be quite nice, and it is representative of what I would expect in most "modern" languages. You can now replace the type arguments required to invoke the constructor of a generic class with an empty set of type parameters (<>) as long as the compiler can infer the type arguments from the context. This pair of angle brackets is informally called the diamond.
    • The try-with-resources Statement : I find this new language feature to be quite interesting. There are many times where I can see this making a lot of sense, especially with database connections and the like. The try-with-resources statement is a try statement that declares one or more resources. A resource is an object that must be closed after the program is finished with it. The try-with-resources statement ensures that each resource is closed at the end of the statement. Any object that implements the new java.lang.AutoCloseable interface or the interface can be used as a resource. The classes, OutputStream, Reader, Writer, java.sql.Connection, Statement, and ResultSet have been retrofitted to implement the AutoCloseable interface and can all be used as resources in a try-with-resources statement.
    • Catching Multiple Exception Types and Rethrowing Exceptions with Improved Type Checking : This complements the previous feature nicely, and this should be an improvement over various nested-exception-handling alternatives. A single catch block can now handle more than one type of exception. In addition, the compiler performs more precise analysis of rethrown exceptions than earlier releases of Java SE. This enables you to specify more specific exception types in the throws clause of a method declaration.
    • Binary Literals : the integral types (byte, short, int, and long) can also be expressed using the binary number system by adding the prefix "0b" or "0B" to the number. Not a huge change, but nifty.
    • Underscores in Numeric Literals : I consider this a "nice to have" more than anything. You can now use any number of underscore characters (_) anywhere between digits in a numerical literal to separate groups of digits in numeric literals.
    • Improved Compiler Warnings and Errors When Using Non-Reifiable Formal Parameters with Varargs Methods
  • New Java Virtual Machine (JVM) Abilities in Java SE 7: Support for Non-Java Languages (via a new JVM instruction that simplifies the implementation of dynamically typed programming languages on the JVM), Garbage-First Collector (a server-style garbage collector that replaces the Concurrent Mark-Sweep Collector (CMS)), and various Java HotSpot Virtual Machine Performance Enhancements
  • Enhancements in Java SE 7 JDBC : JDBC 4.1 introduces the ability to use a try-with-resources statement to automatically close resources of type Connection, ResultSet, and Statement and support for RowSet 1.1 (the introduction of the RowSetFactory interface and the RowSetProvider class, which enable you to create all types of row sets supported by your JDBC driver.)
  • Enhancements in Java I/O: [this was an area that always prevented me from using Java for any "real" software development work] thankfully, this area got a fair amount of attention with Java I/O features being improved considerably with the new NIO 2, Non-blocking I/O 2. If you need to work with files (I always wondered: "who does not need to?"), this should make Java more usable for what I call "real" applications.
  • Swing Enhancements in Java SE 7 : this includes new or improved items including the JLayer Class (a flexible and powerful decorator for Swing components), the Nimbus Look & Feel, support for some mixing of Heavyweight and Lightweight Components, support for Shaped and Translucent Windows (think, modern transparency and non-rectangular shapes), and a tab for Hue-Saturation-Luminance (HSL) Color Selection in JColorChooser Class.
  • Networking Enhancements in Java SE 7: a URLClassLoader.close method has been added.
  • Java™ SE 7 Release Security Enhancements: a slew of new security related enhancements including a native Elliptic Curve Cryptography (ECC) provider; CertPath Algorithm Disabling (allowing weak cryptographic algorithms to be disabled), and updates to JSSE (SSL/TLS) to support TLS 1.1, TLS 1.2, Connection-sensitive trust management, Endpoint verification, TLS renegotiation, and Server Name Indication (SNI) for JSSE client.
  • Concurrency Utilities Enhancements in Java SE 7: The fork/join framework (based on the ForkJoinPool class) is an implementation of the Executor interface designed to efficiently run a large number of tasks using a pool of worker threads.
  • Client JRE Capabilities (RIA - Rich Internet Applications in particular) have been further improved to create what I call "modern" looking applications.
  • Java 2D Enhancements in Java SE 7: a new XRender-based Java 2D rendering pipeline is supported for modern X11-based desktops, offering improved graphics performance; Support for OpenType/CFF Fonts, and Support for Linux Fonts(where libfontconfig is used to select fonts to use for the logical fonts for "unrecognized" Linux platforms)
  • Plus other enhancements to: Java XML Technology (JAXP, JAXB, JAX-WS); Multithreaded Custom Class Loaders in Java SE 7 (potential deadlocks were eliminated for multithreaded, non-hierarchically delegating custom class loaders),

Some Other RFE's addressed in Java 7

The following is a list of some of the RFE's that were addressed in Java 7 that I considered noteworthy as I dug through the rather lengthy list of RFEs discussed in the release notes for Java 7 (there are quite a few more, but these are things I had interest in):
  • (Tools) A succinct and concise error message is printed, as appropriate, when an error occurs during the Java launcher initialization.
  • (Tools) The HtmlConverter tool is no longer part of the JDK 7 distribution
  • (Tools) The javadoc tool has been updated to use style markup classes that can control the styles of the generated pages.
  • (HotSpot) The default out-of-the-box heap size and shape parameters for the concurrent mark sweep collector (CMS) have been modified. The new settings take advantage of faster platforms [yeah, I'd say so in five years!] that have introduced since JDK 6 was released.
  • (HotSpot) The GarbageFirst (G1) garbage collector is experimental in this release.
  • (Plugin) 64-bit toolkit is now supported on 64-bit Windows platforms.
  • (Plugin) Google Chrome is now supported by the DT Plugin (DT being deployment toolkit I believe).
  • (API: AWT - Abstract Window Toolkit) All java.awt.Window objects (not frames or dialogs) are regular top-level windows on X11.
  • (API: AWT) The mechanism used to detect whether the window manager supports a system tray has been changed (now uses the System Tray Protocol Specification)
  • (API: AWT) Limited mixing of heavyweight (e.g. AWT) and lightweight (e.g. Swing) components is now officially supported.

More on What's New in Java7 / JRE7 / JDK7 / Java SE7

I hope I have given you a feel for what to expect with regards to new features in Java 7, especially features that may be interesting to you as a software developer. I MAY take Java seriously as a potential development language now, but... I need to dive into things like the file-I/O in more detail and see how it compares to what I am used to with Embarcadero Delphi (VCL Framework) or Microsoft DotNet Frameworks and development environments and languages.

Also, there were a LOT of big features that were highly anticipated (by me, and others) originally slated for Java 7 that did not make it into this release. Things like unified and robust date / datetime / time support. To me, I can hardly take any language/framework seriously if it does not provide native support for this type of thing. Sure, I can add on the the support I need (perhaps) with something like Joda / Jodatime or whatever, but please... why is something so basic (as a business software requirement) not included in the basics of the framework, language, types, etc? I find that really annoying, and another reason I avoid Java (or have avoided; time will tell if my avoidance is permanent).

 I really WANT to use Java for some things and want to be able to use Java for certain things — in particular I have some projects I wanted to implement using NetBeans platform components, which would sure imply Java as my primary development language to go with it ideally. Well, we shall see. If you want more information see this Java7 link to Oracle's page of Java 7 New Features and Release Notes and such.

Get ready to dive into all sorts of detail and read those lovely "RFE" entries!


Raj said...

Thanks for the informative blog. Can you tell is the JVA JRE 7 installable on Windows XP which is running without any service pack. I tried to install it on such a system but it is giving me error. I don't its requirements.


Mike Eberhart said...

Wow, I didn't know *anyone* had XP without any service packs these days. I would think that you would have a lot of open security-holes on such a system. But, that issue aside, I looked around and could not find any confirmation of what Service-Pack level is required of Java 7. I do not have any un-patched installs of XP around (In fact, I could not even find a virtual-machine around here pre-SP2) to try this on.

If I had to GUESS, I would put the probability of XP SP2 (minimum SP) as a requirement at 50% or so, and XP SP3 at perhaps 90%+ as a requirement. But, I just do not know for sure. IF anyone reading this knows the answer, please post it. Thanks.

Raj said...


Thanks for replying Mike. I think now I have to install buggy JRE 6.

Actually, I'm deliberately running the system without any service packs. I have noticed they slow down the system considerably. Since I'm an advanced user, I am facing no problem of malwares or anything else, at least so far, with the unpatched system. I am just using ESET 5 Smart Security RC on it and guess what even the new dangerous virus that comes regularly from my pen drive fail to compromise the system!

yoyoooyoy said...

Hi Mike,

interesting reading.

On I/O and try-and-resources stuff, i'm disappointed because Oracle write it's not 100% sure Java will release all resources automatically if you declare more than one resource (nesting resources is advices as "good practice"). Not "smell" good enough to delegated on Java7 that resources releases.

Why do you may consider now Java7 as development language? I don't see major advantages for changing any mind.

Raj, interesting idea using Windows XP with no SP, maybe i'll try.

Florian Brunner said...

@Raj: Where have you read about these try-with-resources issues? I couldn't find that statement and my experiments showed everything works fine so far.