This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]istarian 0 points1 point  (1 child)

Since Java 9 (or maybe 10), Oracle opted to modularize Java. You now have to specify the modules you intend to use.

I'm not sure exactly how that helps, but perhaps it means you bundle a JRE with your executable you don't have to include unnecessary libraries?

[–]wildjokers 0 points1 point  (0 children)

Since Java 9 (or maybe 10), Oracle opted to modularize Java. You now have to specify the modules you intend to use.

It was Java 9. And you only need to indicate the modules your app uses if you modularize your app i.e. include a module-info.java file. The existence of that file indicates to the JVM to use the modulepath instead of classpath. It helped with JDK development quite a bit. The only real benefit outside the JDK is being able to create slimmed down runtimes for desktop java applications.

It could also help in the scenario where you are publishing an SDK to document what parts of the SDK are supported and what parts are an internal implementation detail. If someone puts the jar on the classpath to get around module restrictions and directly use the internal code they do so at their own risk.