GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing en.wikipedia.org — Java Platform Module System - Wikipedia (Redirected from Java Module System) The Java Platform Module System (JPMS) specifies a distribution format for collections of Java code and associated resources.[1] It also specifies a repository for storing these collections, or modules, and identifies how they can be discovered, loaded and checked for integrity. It includes features such as namespaces with the aim of fixing some of the shortcomings in the existing JAR format, especially the JAR Hell, which can lead to issues such as classpath and class loading problems. The Java Module System was initially being developed under the Java Community Process as JSR 277 and was scheduled to be released with Java 7. JSR 277 later was put on hold and Project Jigsaw[2] was created to modularize the JDK. This JSR was superseded by JSR 376 (Java Platform Module System). Project Jigsaw was originally intended for Java 7 (2011) but was deferred to Java 8 (2014) as part of Plan B,[3] and again deferred to a Java 9 release in 2017.[4] Java 9 including the Java Module System was released on September 21, 2017.[5][6] ArchitectureThe Java Module System implemented in Java 9 includes the following JEPs and JSR (Java Specification Request):[2]
Additionally, several other JDK 9 features have been added to ease transition to the module system:
Properties of modulesModules are used to group packages and tightly control what packages belong to the public API. Contrary to Jar files, modules explicitly declare which modules they depend on, and what packages they export.[13] Explicit dependency declarations improve the integrity of the code, by making it easier to reason about large applications and the dependencies between software components. The module declaration is placed in a file named module-info.java at the root of the module's source-file hierarchy. The JDK will verify dependencies and interactions between modules both at compile-time and runtime. For example, the following module declaration declares that the module module org.wikipedia.bar { requires org.wikipedia.baz; exports org.wikipedia.bar.alpha; exports org.wikipedia.bar.beta; } The public members of The JDK itself has been modularized in Java 9.[15] For example, the majority of the Java standard library is exported by the module As of Java 25, modules can themselves be imported, automatically importing all exported packages.[16] This is done using import java.sql.*; import javax.sql.*; // Remaining indirect exports from java.logging, java.transaction.xa, and java.xml Similarly, package org.wikipedia.examples; import module java.base; /** * Importing module java.base allows us to avoid manually importing most classes * The following classes (outside of java.lang) are used: * - java.text.MessageFormat * - java.util.Date * - java.util.List * - java.util.concurrent.ThreadLocalRandom */ public class Example { public static void main(String[] args) { List<String> colours = List.of("Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"); IO.println(MessageFormat.format("My favourite colour is {0} and today is {1,date,long}", colours.get(ThreadLocalRandom.current().nextInt(colours.size())), new Date() )); } } Modules use the following keywords:
Standard modulesCore modulesThe modules under namespace
The module module jdk.unsupported { exports sun.misc; exports sun.reflect; exports com.sun.nio.file; opens sun.misc; opens sun.reflect; } Jakarta EE, formerly part of the Java standard library, is not modularised, however build systems can generate automatic modules for it. JavaFX modulesJavaFX was previously bundled with the core JDK, until Java 11 when it was split into OpenJFX. JavaFX is split into the following modules.[20]
Links with OSGiThe Java Module System does not intend to support all the functionalities that the OSGi platform currently supports (for example the Life-Cycle model and the Services Registry). However the Java Module System will support functions which are not supported by OSGi, such as modularity at compile-time, and built-in support for native libraries.[21] A couple of articles exploring how the Java Module System and OSGi could interoperate were published in 2016. These can be found on InfoQ[22] and also the OSGi Alliance Blog.[23] See alsoReferences
External links | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |