Java Magazine, Sept/Oct 2017
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2017 31 java 9 If you did not specify the entry point when creating the JAR you can still run the app by specifying the module name and fully qualified class name as in java module path jars module com deitel welcome com deitel welcome Welcome or java p jars m com deitel welcome com deitel welcome Welcome Classpath vs module path Before Java 9 the compiler and runtime located types via the classpath a list of folders and library archive files containing compiled Java classes In earlier Java versions the classpath was defined by a combination of a CLASSPATH environment variable extensions placed in a special folder of the JRE and options provided to the javac and java commands Because types could be loaded from several diferent locations the order in which those locations were searched resulted in brittle apps For example many years ago I installed a Java app from a third party vendor on my system The apps installer placed an old version of a third party Java library into the JREs extensions folder Several other Java apps on my system depended on a newer version of that library with additional types and enhanced versions of the librarys older types Because classes in the JREs extensions folder were loaded before other classes on the classpath the apps that depended on the newer library version stopped working failing at runtime with NoClassDefFoundErrors and NoSuchMethodErrors sometimes long after the apps began executing For more information on class loading see Understanding Extension Class Loading The reliable configuration provided by modules and module descriptors helps eliminate many such runtime classpath problems Every module explicitly states its The reliable configuration provided by modules and module descriptors helps eliminate many runtime classpath problems
You must have JavaScript enabled to view digital editions.