How to get list of all modules programmatically in Java 9?

Pavel_K :

How can I get list of all modules in current JVM instance via Java code? Is it possible? If yes, then how?

Alan Bateman :
ModuleLayer.boot().modules().stream()
                .map(Module::getName)
                .forEach(System.out::println);

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=435955&siteId=1