Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable modules in Java 9? [closed]

Tags:

java

java-9

I use OSGI and this is the main reason that I want to disable modules, as I really don't need another module framework. Is it possible to do it, for example using command line option? If yes, then how?

like image 545
Pavel_K Avatar asked Sep 05 '17 18:09

Pavel_K


People also ask

Which of the following is correct about module system in Java 9?

Q 7 - Which of the following is correct about Module System in Java 9? A - javac, jlink, and java have additional options to specify module paths, which further locate definitions of modules.

Should we use Java modules?

No. There is no need to switch to modules. There has never been a need to switch to modules. Java 9 and later releases support traditional JAR files on the traditional class path, via the concept of the unnamed module, and will likely do so until the heat death of the universe.

What are modules in Java 9?

It is a set of related Packages, Types (classes, abstract classes, interfaces etc) with Code & Data and Resources. Each Module contains only a set of related code and data to support Single Responsibility (Functionality) Principle (SRP). The main goal of Java 9 Module System is to support Modular Programming in Java.

Why do we need Java modules?

Software developers can decompose a monolithic Java application into many single-purpose modules. Properly architected applications using SOLID principles and modules can yield applications that are easier to maintain than if the application were a monolith, which again saves money.


1 Answers

There is no option to turn off the module system - it will always be active. This impacts access to JDK-internal APIs, dependencies on Java EE modules, Split packages, and a lot of other small details. Your code and your dependencies have to deal with those migration challenges if you want your application to run on Java 9.

You are by no means forced to create modules, though. You can completely ignore module-info.java and continue to place all your JARs onto the class path. The module system will silently bundle them all into the unnamed module, which was created for maximum compatibility. You won't even notice the module system is there (assuming you've overcome the challenges I described earlier).

like image 176
Nicolai Parlog Avatar answered Oct 13 '22 19:10

Nicolai Parlog