Thursday 11 May 2017

The latest on Java 9... will it be delayed, features removed, or released with problems?

In case you’ve not been following the progress of the next release of Java SE,  Java 9, we thought we should let you know what the current status is (or at least our current understanding of it!).

As you might expect, the next version of Java will have some changes in it from the earlier versions. By far the biggest, is the introduction of Jigsaw, an API for building modular applications. Some have described this as a bigger change for Java than when generics were introduced back in Java 5.

If you’re not familiar with modular applications, then in simple terms the idea is that you can split larger applications into smaller parts (modules). Each module can depend on / use other modules, but they’re built as separate projects, and compiled into separate Jar files. There are quite a few potential benefits to this approach, but perhaps the most useful is that if you need to change a single module, you can do that without needing to amend or recompile any of the other modules. There's more to it than this, but that's a very simple high level overview.

If this sounds familiar (you may be thinking about microservices) well it’s another way of solving the same problem that microservices solves, at least in terms of building smaller, more manageable applications rather than monoliths.

Actually if you have a need for modular Java right now, then you don’t need to wait for Jigsaw – the OSGi framework (https://www.osgi.org/) provides this today, and although I've never used it personally, everyone I have met who has say it works well. Unfortunately Jigsaw isn’t compatible with OSGi… I guess there are some politics involved as to why they didn’t adopt OSGi as the standard!

So that’s the background… what’s the current status?

Well Jigsaw is having some problems. I have tried using it myself, with the current beta release of the Java 9 JDK. I thought it might be an interesting and useful exercise to take an internal Spring Boot based application that we use at Virtual Pair Programmers, and upgrade it to make it modular.

Unfortunately I ran into some problems doing this, including:
  • Maven doesn’t work with Jigsaw right now. So if you want to build a set of modular Spring Boot applications, for example, well it’s possible in theory but highly frustrating in practice…. it involves writing a number of shell scripts and delving into the file system to work out where all the maven dependency jars have been put, so that you can reference them in your compilation scripts.
  • Eclipse doesn’t really cope well with Modular projects right now. It can be used to edit them (although you’ll do some frustrating manual moving around of the file structure to get it to work) but you can’t currently create a modular Jar / War file from Eclipse. Again you'll end up writing shell scripts to do these. We understand that other IDEs have similar issues.


This means that today, Jigsaw is really not ready for use.  We recently attended the London Java User Group’s hackday to get an introduction to Java 9, and certainly left there with a feeling that the modular approach is going to take some getting used to… and without full integration with familiar build tools and IDEs, it won’t get widely adopted. 

It seems that more widely within the Java community our view that Jigsaw isn’t ready is shared… and not just for the reasons we have come across. Currently 13 of the 23 organisations that have a vote on the Java Committee have voted no to Jigsaw being ready to release (https://jcp.org/en/jsr/results?id=5959).


Currently Java 9 is scheduled for release on July 27 2017. Whether it gets delayed, it gets released without Jigsaw, or the Jigsaw issues get sufficiently fixed in time, we’ll have to wait to see!

Monday 8 May 2017

Installing Groovy - which version to go for?

Since we released the Groovy course, there have been some changes to the hosting of the Groovy distribution files. The newer versions of Groovy are completely compatible with the course, so you're fine to use any, but you'll need to download them from:

http://groovy-lang.org/download.html

Please note that for Windows users, the latest version may not have a windows installer available. To get started quickly you may wish to check a prior version with a Windows installer. At the time of creating this blog post, 2.4.11 is the latest stable version of Groovy, but if you want the Windows installer you'll need to get 2.4.10.

We also mention in this course that at the time of recording we were planning a course on Grails. We held off for the release of Grails 3, we knew that each version of Grails tends to break something in earlier versions / is not always backwards compatible. Unfortunately the Grails project has lost popularity in recent years (mainly due to political reasons I believe) and so a course on Grails has not been a viable option.

However for fans of the Groovy language, it's perfectly possible to create Spring Boot applications in Groovy - and indeed this is effectively where Grails was heading anyway. So Combining Groovy and our Spring MVC / Spring Boot courses will allow you to build production quality web applications in Groovy... and that's our recommended way forward!

Sunday 7 May 2017

Errata for Hadoop course - Installing Java with Ubuntu

In chapter 4 of the Hadoop course we set up a new Virtual Machine, running Linux. This step is not needed if you're already using Linux or a Mac to run the course, but is needed for Windows users.

In the course we install the Java JDK version 7. However this is no longer available from the repositories, and you'll now need to use Java version 8. We've tested the course with this version of Java and are not aware of any issues.

To install Java version 8 issue the following command:

sudo apt-get install openjdk-8-jre-headless

instead of

sudo apt-get install openjdk-7-jre