The latest expert opinions, articles, and guides for the Java professional.
Java 9 is finally here
After many delays, we finally get our hands on Java 9, along with its new features and improvements!
One of the greatest and most talked about new features in Java 9 is the Java Platform Module System (previously known as Project Jigsaw). Not only has the Java runtime been split into individual modules, Java now also supports the creation of your own modules and declaring their interdependencies. This can now be done without the use of a third party module runtime (like an OSGi container). The module system also introduces stricter access checks for compile time, runtime, and reflection. Public is no longer public! You can now have classes that are public to other classes in your module — and only your module — as well as limit how classes in other modules can manipulate your private state using reflection.
Another long-awaited addition to the JDK is JShell, the new REPL for Java. Using JShell makes it easy to run a few lines of code to test small things, without having to write the surrounding class and main method. For example, you can test a new API or set the classpath to point to your project’s classes, allowing you to interact with all your classes from inside JShell.
Lots of other new stuff also went into Java 9. Here are a few more headliners: improvements to the Stream API, Collections API-improvements for making immutable Maps, Sets, and Lists, a new Process API, a new HTTP/2 client API, and much more. Java 9 even ships with the unlimited cryptographic policy by default.
Redeploys remain, JRebel helps
One of the things that Java 9 hasn’t improved upon is its restrictions on reloading class changes at runtime — without having to restart or redeploy your application. From a security perspective, this arguably strengthens your production system. Meaning that you are limited in what changes can be made to classes already loaded. Unfortunately, this also hinders your productivity during development, exactly when this capability is needed.
Using JRebel as part of your Java 9 development tool suite allows you to skip the time-consuming build and redeploy steps. JRebel supports reloading classes so you get the benefit of being able to do full class reloading during development, without the need for restarting or redeploying your application. In addition, JRebel 7.1.0 also includes support for reloading your Java 9 module declarations. For instance, adding a new service class and declaring the corresponding provides and uses lines in your modules has never been easier! Create the new service, modify the module-info.java files, make sure your IDE compiles them and JRebel will pick up the new bytes. Your new service class is up and running in no time.
But why take our word for it — try it out for yourself. Update the JRebel plugin in your IDE of choice, download the Java 9 JDK, and you’ll quickly be up and running. New to JRebel? Not a
problem — you can sign up for a free trial right within your favorite IDE. Simply download the plugin, activate the 14 day evaluation and start skipping those redeploys today!
JRebel continues to improve
But wait, there’s more! Since the launch of JRebel 7.0.0 in November last year, we’ve been hard at work. We have released 15 versions of JRebel since then, adding support for more than 100 new versions of frameworks and application servers. This includes support for new major versions like Spring Framework 5, Weld 3, Hibernate Validator 6.0, WebSphere Liberty Profile 17, Vaadin 8, Tomcat 9, Liferay DXP.
Our awesome IDE plugins, which make configuring and working with JRebel a breeze, keep improving as well. It is now easier than ever to use JRebel with Gradle and Spring Boot applications. The embedded startup instructions in the IDE plugins have been updated with the latest information. These help guide you to successfully configure applications to work with JRebel. IDE notifications have been overhauled, making sure that all vital information is presented without being overly intrusive. And for those feeling adventurous, and wanting to stay on the bleeding edge, we provide the nightly builds of JRebel. These are now just a single click away in your IDE!
With Java 9 out and kicking, it is time to send Java 1.4 off to a well-deserved rest in the retirement home — or your local computer science museum. As of JRebel 7.1.0, Java 1.4 is no longer supported.
Download JRebel 7.1.0
As always, for a full list of changes, see the JRebel changelog.
Community driven, Java Champion approved
Leading up to the release of Java 9, RebelLabs reached out to nine Java Champions to ask them questions about Java 9. These included questions about new features, how Oracle handled the release, and summing up Java 9 in just three words. The overall consensus was that Oracle ended up handling the release pretty well, scoring an average 7.5 out of 9. They delivered a “very necessary release”, and especially the last few months of jigsaw debates highlighted how “Community Involvement Rocks!”
For the question about their favorite feature, the answers varied a lot. Besides the new features mentioned earlier, smaller or niche features did get mentioned here. This included the relatively small language change of effectively final variables in try-with-resources, and support for VarHandles. If MethodHandles is considered Reflection 2.0 for method invocation, VarHandles is Reflection 2.0 for accessing variables.
What many champions did mention was that Java 9 paves the way for future versions and evolution. Whether that may be via the module system making things more lean and easier to add new features as incubator modules, or that for the first time features and API can be flagged for deprecation and future removal! With the recent announcement that Java is moving to a more rapid release schedule, these are certainly things that can greatly impact the future of Java.
No comments yet.
Leave a comment