Java Trends In 2018, CLI Fu, JMS Update

CodeFX Weekly #52 — 12th of January 2018

Nicolai Parlog
Jan 16, 2018 · 5 min read

Hi everyone,

ok, fun time is over. The year really started and so the weekly is back to more technical content.

I was stupid enough to make some predictions for Java in 2018, which I’ve restated here. Then come a few command line tricks and updates on the book. Shots are great this week!

I send this newsletter out every Friday. Yes, as an actual email. Subscribe!


Java Trend for 2018

I was recently asked for my opinion on tech trends for the new year (German). What a no-brainer, 2018 is the year of Linux on the desktop. Obviously.

Beyond that, here’s my answer:

In the Java world, it’s gonna be the six-month release cycle. Developers as well as companies and services will have to get used to the fact that a major Java version will now be released every six months instead of every three years.

Up to now, even those who were always working with the newest version only needed to pay attention every two, three years to learn about new and updated features. On the JDK’s side, the erratic updates will now be replaced by a smoother process — it’s up to us in the community to follow suit (or not).

That’s gonna be particularly interesting for the creators of Java content. The time in which you’d start publishing articles, videos, books, etc twelve months before a new release while happily slapping the version on everything is over. We only definitely know what goes into a release about three months before it comes out and we have to adjust for the fact that searches for “Java 10 var” will decrease much faster than for “Java 8 Lambda” — simply because after two years (and four releases!), nobody will know anymore which version introduced a feature.

All in all, creators as well as readers will have to pay more attention to the development projects that progress in the background (e.g. Amber, Valhalla, Panama, Loom) than just to what comes out in the end. I think that’s actually A Good Thing because it brings the community and the JDK’s development team closer together.


Command line fu for the JPMS

Here are some Linux pipelines that I built over the recent week to aid and abet my research into jlink.

Platform dependencies

The first one uses jdeps and a few filters and maps to analyze an application (app.jar) and its dependencies (in jars folder) in order to create a list of the platform modules the app depends on:

jdeps -summary -recursive --class-path 'jars/*' jars/app.jar
| grep '\-> java.\|\-> jdk.'
| sed 's/^.*-> //'
| sort -u

You can use the output to create a minimal runtime image with jlink that supports your application. Thing is, you might be missing some services offered by platform modules that you didn't even know about. (That's because, by default, jlink does not bind services.) Next step is to find out more about that.

Platform service users

So which services do the platform modules use? First, it makes sense to collect all module descriptors in a file:

java --list-modules
| sed -e 's/@.*//'
| xargs -n1 java --describe-module
> module-descriptors

This lists all modules, removes the version strings and then lets Java describe each module, which includes the modules descriptor.

Next steps are filtering by uses directives, removing the uses part, and sorting:

cat /opt/jdk-9/module-descriptors
| grep 'uses'
| sed 's/uses //'
| sort -u

There you go.

Platform services providers

And if you want to know, which modules provide a specific service, you can use jlink --suggest-providers ${service} for a single service or this chain for a whole bunch of them:

cat /opt/jdk-9/module-descriptors
| grep uses
| sed 's/uses //'
| sort -u
| xargs -I % jlink --module-path /opt/jdk-9/jmods
--suggest-providers %
| grep -v "No provider found"

If it’s just a specific module’s use of services you’re after, replace cat /opt/jdk-9/module-descriptors with java --describe-module %{module}.

There you go.


The Java Module System

Regarding my motivational problems… I finished the chapter on services during the first days of November and then I hit a mental road block. It took me until last Friday to start creating new content again. Two months! (Don’t get me wrong, I did work on the book in the meantime — just didn’t write new chapters).

Last Friday I finally got going again and it took me five days of focused work, but no long hours, to write 30 pages (about jlink). Seriously, WTF?! Why did I fight that? What was my problem? This is ridiculous.

Aaaanyways. I finished chapter 13 on jlink and will soon start working on chapter 12, reflection. After that there's the final chapter, 14, which puts all the pieces together and draws some larger conclusions. Also, a catch-all for everything else I wanted to say.

When all that’s done mid-February, the book goes into the final review, followed by another three weeks of editing before it “goes into production” at the end of March. Another ten or so weeks later, it will be out. About nine months later than I would have liked, but I have only myself to blame for that.

In the meantime, we published chapter 11:

  • 11.1. Implied readability
  • 11.1.1. Exposing dependencies
  • 11.1.2. The transitive modifier
  • 11.1.3. When to use implied readability
  • 11.1.4. When to rely on implied readability
  • 11.1.5. Refactoring modules with implied readability
  • 11.2. Optional dependencies
  • 11.2.1. The conundrum of unrequired dependencies
  • 11.2.2. The static modifier
  • 11.2.3. How module resolution handles optional dependencies
  • 11.2.4. Coding against optional dependencies
  • 11.3. Qualified Exports
  • 11.3.1. Exposing internal APIs
  • 11.3.2. Exporting packages to modules
  • 11.3.3. When to use qualified exports
  • 11.3.4. Exporting packages on the command line
  • 11.4. Summary


PS: Don’t forget to subscribe or recommend! :)

The image cmd.exe was published by *n3wjack's world in pixels under CC-BY-SA 2.0. I cropped it and republish under the same license.

CodeFX Weekly

Whatever caught my interest throughout the week: libraries or tools I am using, what I’ve written or read that might interest you, fascinating questions on StackOverflow, conferences visits, odd tweets, anything really that connects to Java, software development, or writing.

Nicolai Parlog

Written by

Developer (mostly Java), blogger (http://codefx.org/), author (http://tiny.cc/jms), trainer (http://courses.codefx.org & https://www.youtube.com/c/codefx)

CodeFX Weekly

Whatever caught my interest throughout the week: libraries or tools I am using, what I’ve written or read that might interest you, fascinating questions on StackOverflow, conferences visits, odd tweets, anything really that connects to Java, software development, or writing.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade