简体   繁体   中英

What is the use of limitmods flag and listmods in jdk9/java-9?

As Java-9 come with the concept of modularity. They have added two new flags in JDK. -listmods and -limitmods .

What is the use of those flag and how to use? Can anyone explain in more detail?

First, these were re-named to : --limit-modules and --list-modules .

The documentation seems pretty descriptive for them IMO:

-- list-modules displays the names and version strings of the observable modules, and then exits, in the same manner as java -version.

-- list-modules (,)* displays the full module descriptors of the named modules, if observable, and then exits.

While limit-module will limit the modules that are observable.

It is sometimes useful to limit the observable modules for, eg, debugging, or to reduce the number of modules resolved when the main module is the unnamed module defined by the application class loader for the class path

There are some good tutorials explaining in a bit more details (but with the old syntax) what the first actually does, like this one.

I have to admit that I am still trying to fully grasp these features, so this is more of a reference of where to start digging then an actual answer probably.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM