• Complain

Alexandru Jecan [Alexandru Jecan] - Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications

Here you can read online Alexandru Jecan [Alexandru Jecan] - Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: Apress, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Alexandru Jecan [Alexandru Jecan] Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications
  • Book:
    Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications
  • Author:
  • Publisher:
    Apress
  • Genre:
  • Year:
    2017
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Develop modular applications using the Java Platform Module System, the single most anticipated feature in Java 9. You will improve maintainability and performance of your Java applications by deploying only modules that are needed and encapsulating their implementation details.
Until now Java has been monolithic. Using any one part of Java has meant incorporating the entirety of the runtime environment, an approach ill-suited to the increasing number of IoT devices such as fitness monitors, kitchen appliances, toys and games, and so forth. This book shows a new way, to make Java scale from the smallest of footprints in the smallest of devices through desktop PCs and on up to server platforms.
With Java 9 ModularityRevealed you will learn to make your projects more reliable and scalable than ever using the most important feature in Java 9The Java Platform Module System, known more commonly as Project Jigsaw. You will learn how to avoid one of the major pain points of Java programming, that of conflicting class names from different modules, or packages. You will learn to create custom run-time images that represent a minimal and more compact JRE containing only those modules that you need. You will further learn to migrate existing Java applications to modular ones using different approaches and tools. The end result is a new ability to plug together different modules without fear of namespace and other conflicts, and you can deploy to everything from small devices to large servers.
This book provides code examples and explanations.
What Youll Learn
  • Build Java applications using the new modular system introduced in Java 9
  • Create your own JRE consisting only of the modules that you require
  • Adapt your testing techniques toward modular applications
  • lare your dependencies on other modules
  • Enable modules to export only specific packages
  • Migrate existing Java applications to modular ones
  • Improve maintainability and performance of Java applications

Who This Book Is For
Experienced Java programmers wanting to keep up and become informed on the new modularity support in Java 9

Alexandru Jecan [Alexandru Jecan]: author's other books


Who wrote Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications? Find out the surname, the name of the author of the book and a list of all author's works by series.

Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Alexandru Jecan 2017
Alexandru Jecan Java 9 Modularity Revealed
10. Advanced Topics
Alexandru Jecan 1
(1)
Munich, Germany
Applications with plugin and container architectures need to be able to use two important features: dynamic configuration and runtime augmentation of platform modules. This means that such applications must be able to load new additional modules at runtime, bind them into the existing applications configuration, and use them without the need to stop the application and compile it again. This type of application also needs to be able to load and configure other platform modules after a runtime image has been invoked. Jigsaw introduces such support in form of layers. Layers are one of the main subjects of this chapter.
This chapter presents some advanced topics on Java 9 modularity. They didnt fit in the other chapters, so we put them here instead of creating separate chapters for each of them.
This chapter covers class loaders, layers, the JMOD format, multi-release JAR files, and upgradeable modules. Well also touch on some new features that will come in the next JDK releases and a couple of issues that were fixed.
JMOD Files
According to the JDK 9 documentation, for the purpose of modularizing the JDK, a new artifact format called JMOD goes beyond JAR files to accommodate native code, configuration files, and other kinds of data that do not fit naturally, if at all, into JAR files.
A JMOD file is a new module artifact that consists of a compiled module definition in the form of a ZIP file. It enhances a JAR file by also including native code and configuration files. JMOD is a new format used for packaging the modules. This new format isnt executable.
A JMOD file is an alternative to the modular JAR file covered in Chapter . Its mostly used when a module also contains native code . JMOD files are used to package the modules of the JDK, but they can be used only at compile-time and link-time. They cant be used at runtime. The JMOD files are also used by the Jlink tool to create a modular runtime image. The directory consisting of the JMOD files represents the module path used by the linker.
The JMOD Tool
The JMOD tool can be especially used for the following:
  • To create a JMOD file for a standard or JDK-specific module
  • To list the content of an existing JMOD file
The JMOD tool has been extended in order to be able to install a module as a JAR file with a module-info in the top level directory. In other words, the JMOD tool is to the new JMOD format similar to what the jar tool is to the JAR format.
Using the jmod command we can create a new JMOD archive:
jmod create
The jmod create command creates a new JMOD archive named . Table lists some of the most important options of the JMOD tool, as specified in the JDK specification.
Table 10-1.
Summary of the Options Provided by the JMOD Tool
Option
Description
--class-path
Specifies the application JAR files that contain classes.
--config
Defines directories holding user-editable configuration files that are copied into the JMOD file.
--exclude
The files matching wont be copied into the JMOD file. is comma-separated and can have one of the formats: , glob: , or regex: .
--libs
Defines the directories containing native libraries that are copied into the JMOD file.
--main-class
Defines the main class.
--module-version
Defines the module version.
--module-path or -p
Specifies the module path where to find the modules with content that will be copied into the JMOD file.
The jmod list command prints the names of all the entries contained in the JMOD file passed as parameter:
jmod list
The jmod describe command prints the details of the module contained in the JMOD file passed as parameter:
jmod describe
The next section discusses the basics of the multi-release JAR files .
Multi-release JAR files
Suppose you want to switch to the latest JDK version but have a third-party library thats incompatible with the latest version of the JDK. As a consequence, you decide not to switch to the latest JDK version at least until the third-party library youre using will be made compatible with the latest version of the JDK. This is a bad scenario that was solved in Java 9 by the introduction of multi-release JAR files , which allow packaging code for different versions of the JDK in a single JAR file.
Multi-release JAR files were implemented in JDK 9 in JEP 238. This JEP isnt part of Jigsaw. We mention it here because its an important feature that helps during migration to Java 9. It doesnt depend on the Java Platform Module System at all. We can use multi-release JAR files in a non-modular world, too.
Java 9 enhances the JAR file format so that multiple major versions of a class can be stored inside a single JAR file, in its META-INF directory. The new JAR file format is called a multi-release JAR and can consist of a single library for different JDK versions. The correct versions of the classes are loaded at runtime depending on the JDK version used by the user. A multi-release JAR file changes the structure of a JAR file only to a low degree.
Note
Multi-release JAR files are supported for both normal JARs and modular JARs.
Listing shows a multi-release JAR file that contains versioning metadata for JDK 8 and JDK 9.
Root of JAR
- A1.class
- B1.class
- C1.class
- D1.class
- E1.class
-META-INF
- MANIFEST.MF
- versions
- 8
- A1.class
- B1.class
- F1.class
- 9
- A1.class
- C1.class
- D1.class
- F1.class
- G1.class
Listing 10-1.
Multi-release JAR file Having Versioning Metadata for JDK 8 and JDK 9
In this example, we have Java .class files in the root directory of the JAR, but also in the 8 and 9 directories. In the META-INF directory , we have the MANIFEST.MF file and a directory called versions, which contains two directories: a directory called 8 that represents the resources provided for JDK 8 and a directory called 9 that represents the resources provided for JDK 9. There are Java .class files in the 8 directory and in the 9 directory. The classes inside the 8 directory will be considered when we use JDK 8, and the classes inside the 9 directory will be considered when we use JDK 9.
The classes in the root directory of the JAR file will be considered in the following situations:
  • If were using a version of JDK different from JDK 8 or JDK 9
  • If were using JDK 8 or JDK 9 and the corresponding classes arent present in the versions/8 and versions/9 directories
Well explain this in detail. For the multi-release JAR file just discussed, we first have to know whether the JDK version were using supports multi-release JAR files. If it doesnt, then everything inside the versions/8 and versions/9 directories will be ignored, and only the class files from the root directory will be considered: A1.class, B1.class, C1.class, D1.class, and E1.class.
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications»

Look at similar books to Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications»

Discussion, reviews of the book Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.