Category: Accessibility Rules for Members

  • Exploring Modules – Java Module System

    19.13 Exploring Modules This section provides an introduction to using the JDK tools to discover, explore, and analyze modular applications. Given the JARs main.jar, control.jar, view.jar, and model.jar for the adviceApp application in the mlib directory in Figure 19.14(c), p. 1188, we will use JDK tools to explore these archives…

  • Goals of the Modular JDK – Java Module System

    Goals of the Modular JDK Specific goals of the modular JDK, not surprisingly, align with the benefits of modules extolled in §19.1, p. 1163. Overview of the Modular JDK The monolithic library of the JDK has now been split into many modules, with each module defining a specific functionality of…

  • Accessibility Rules for Members – Java Module System

    Accessibility Rules for Members Table 19.1 summarizes the accessibility rules for members of a public class A contained in a package pkg1 of module M. Note that class A is public so that it satisfies one of the three conditions discussed earlier for accessibility of a type from another module.…

  • Qualified Export – Java Module System

    Qualified Export Any package that is exported by a module is readable by any module that requires its module. However, sometimes it is necessary that only certain modules can access an exported package. This can be achieved by using the exports-to directive, as shown below at (1), where packageOne in…

  • Creating a Modular Application – Java Module System

    19.5 Creating a Modular Application After understanding the basic role of a module declaration, we can proceed to create a modular application. As support for Java modules is not quite up to par at present in integrated development environments (IDEs), we will use the command-line tools provided by the JDK.…

  • Creating the Application Directory Structure – Java Module System

    Creating the Application Directory Structure Typically, the code for a modular application is organized in a directory structure, similar to the one shown in Figure 19.9. The modules are created in the src directory and compiled into the mods directory. The compiled modules are bundled into modular JARs and placed…

  • Creating JAR Files – Java Module System

    19.7 Creating JAR Files A JAR (Java Archive) file is a convenient way of bundling and deploying Java executable code and any other resources that are required (e.g., image or audio files). A JAR file is created by using the jar tool. The jar command has many options, akin to…

  • Running an Application from a Modular JAR – Java Module System

    Running an Application from a Modular JAR The adviceApp application can be run from the modular JARs in the mlib directory by any of the following java commands, giving the same output as before: Click here to view code image >java –module-path mlib –module main or Click here to view…

  • Additional Support for Formatting in the Java SE Platform APIs – Localization

    Additional Support for Formatting in the Java SE Platform APIs In this subsection we mention additional support for formatting values that is provided by various classes in the Java SE Platform APIs. The class java.util.Formatter provides the core support for formatted text representation of primitive values and objects through its…

  • Specifying the Service Interface – Java Module System

    Specifying the Service Interface The service is represented by the interface IAdvice that is declared in package org.advice.si of the serviceinterface module (Example 19.3). It specifies the functionality that the service will provide: two abstract methods getContent() and getLocale() that return the advice (as a string) and the associated locale…