Home > Software Development > Java SE 7 released, finally!

Java SE 7 released, finally!

After Java 6.0 released in 2006, it’s been 5 years during which Sun Microsystem was sold to Oracle. Today the 7.0 is finally GAed. It includes quite a few changes including small language changes as well as new and improved APIs.

The language changes are mostly small and may not affect you, for example, the switch statement now works with strings. The new try-with-resource statement, which is similar to using statement in C#, helps you with cleaner code, see the difference shown in the following. If your code touches resources that need to be closed, for example file, you should consider using this new statement.

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure

static String readFirstLineFromFile(String path) throws IOException {
  try (BufferedReader br = new BufferedReader(new FileReader(path))) {
    return br.readLine();
static String readFirstLineFromFileWithFinallyBlock(String path) throws IOException {
  BufferedReader br = new BufferedReader(new FileReader(path));
  try {
    return br.readLine();
  } finally {
    if (br != null) br.close();

Another language feature I find useful is related to generics (becuase I used quite a bit in the Web Service engine of VI Java API). Instead of writing the first, you can write the second as shown in following:

Map<String, List<String>> myMap = new HashMap<String, List<String>>();
Map<String, List<String>> myMap = new HashMap<>();

In additions to changes to existing APIs, two new API packages are introduced: JSR 203 (More New I/O APIs for the JavaTM Platform (“NIO.2”) APIs for file system access, scalable asynchronous I/O operations, socket-channel binding and configuration, and multicast datagrams; JSR 166 (Concurrency Utilities), which “provides a mechanism for developers to decompose problems into tasks that can then be executed in parallel across arbitrary numbers of processor cores” (Source: InfoQ), definitely a critical feature with more cores to leverage these days.

Ready to give it a try? Download it here. If you are like me using IDEs, here are NetBean IDE 7.0, IntelliJ IDEA 10.5, and Eclipse Indigo (beta level support).

  1. December 27th, 2012 at 12:51 | #1

    Dear Sun and Oracle Engineers,

    From the beggining Java was a very cool language. Even Microsoft took a shot at building one compiler for it, called J++.

    The project didn’t end well not because of the lack of technical abilities from our part but because Sun realized we were serious competitors and we could leverage the language where they thought it was impossible. Legal battles with Sun resulted in Microsoft dropping the project and creating .NET, so that we could take all the lessons learned and build something even better than Java.

    It took the last 5 years for you to design, code and deploy those 2 “features” for the Java language. You really should consider moving to another industry, because there is no space for you in the high tech industry.

    What a lack a value and courage does it take to make such a boring release. You are making my life so much easy, I think I’m going to fire all those .NET engineers since Java is no longer a threat to my business ecosystem and the customer’s pshycologic environment. You are dead for the consumer in the 10 years to come.

    And don’t even mention those JSRs as proof that you have done something. You have done nothing, nothing at all, which makes me want to sing in the rain, here in rainy Seattle.

    Please, come on, those JSRs: 203 and 166 have been around for at least 10 years, partially or poorly implemented depending on who you ask, not being incorporated in mainstream products as you would expect if they really were well engineered.

    Who designed them? Who designed anything in Java in the last 10 years? No one. That’s your real problem. All the captains have left the boat and now it is sailing where the wind blows. You have a serious wreck ahead of you.

    If you want to fix it, first recognize you have a serious problem.

    With tears in eyes, for laughing so much, I say farewell to you and your toy language,

    Bill Gates
    Chief Architect

  1. No trackbacks yet.