Java Magazine, Jan/Feb 2016
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2016 60 path to java 9 time of this writing late 2015 there are diferent binaries at various levels of completeness that support modules The first Java 9 early access EA builds from Oracle that contain modules are available However the module functionality that is contained in these binaries is limited To supplement the mainline JDK 9 builds and provide even earlier access to modular functionality the Jigsaw project is also making binaries available For the rest of this article the examples and discussion center on the Jigsaw binaries because they are more complete than the JDK 9 mainline The Jigsaw Pieces Project Jigsaw identified several subgoals in the course of a roadmap leading to full modularity These were defined within the Java Enhancement Process JEP and included the following Modularize the layout of the source code in the JDK JEP 201 Modularize the structure of the binary runtime images JEP 220 Disentangle the complex implementation dependencies between JDK packages This last goal was one of the most labor intensive but it was also necessary in order to make modules as independent from each other as possible In turn this goal allows the maximum possible flexibility for modules to be loaded and linked separately As an example of why this is needed consider the java util Properties package which contains a requirement to parse XML This requirement greatly increased the footprint for any code that depended on Properties because it pulled in Javas full XML libraries To fix this a small XML parser based on the original reference implementation JSR 280 was added to remove the heavier dependencies Another example is the RMI IIOP transport which was separated out from the management module so that the remote management module which uses JMX no longer requires CORBA to be present One other minor change is also worth mentioning because it is rather unusual in Javas history A small number of methods in java util logging LogManager were removed from the public API because they caused undesirable linkages between some modules and would have introduced considerable bloat This is one of the very few times that methods have been actually removed from the public API of the JDK after all even the highly dangerous Thread stop is still present despite having been deprecated since Java 11 Removing methods is a very rare event and shows the importance of a good modularity solution to the Java team A First Look at Modules Lets have a look at how things have changed in the Java 9 Jigsaw EA release cd JAVA_ HOME pwd java9 Contents Home ls lh total 42640 r r r 1 10 143 32K COPYRIGHT r r r 1 10 143 40B LICENSE r r r 1 10 143 158B README html r r r 1 10 143 174K THIRDPARTYLIC txt drwxr xr x 46 10 143 15K bin drwxr xr x 7 10 143 238B conf drwxr xr x 9 10 143 306B db drwxr xr x 12 10 143 408B demo drwxr xr x 11 10 143 374B include rw r r 1 10 143 127K jrt fs jar drwxr xr x 84 10 143 28K lib rw r r 1 10 143 549B release drwxr xr x 15 10 143 510B sample rw r r 1 10 143 21M src zip
You must have JavaScript enabled to view digital editions.