SlideShare a Scribd company logo
1 of 66
Download to read offline
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Title Slide with
Java FY15 Theme
Subtitle
Presenter’s Name
Presenter’s Title
Organization, Division or Business Unit
Month 00, 2014
Note: The speaker notes for this slide
include detailed instructions on how to reuse
this Title Slide in another presentation.
Tip! Remember to remove this text box.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
JDK 10 features
Java Module System
Wolfgang Weigend
Sen. Leitender Systemberater
Java Technology and Architecture
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
2
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Agenda
Java Version Numbers
Java in a World of Containers and Open Source
JDK 10 Migration Guide
JDK 10 Features
Modularity
Java Module System and Tools
Summary
1
2
3
4
3
5
6
7
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Rules for Java CPU’s
− Main release for security vulnerabilities
− Covers all JDK families (10, 9, 8, 7, 6)
− CPU release triggers Auto-update
− Dates published 12 months in advance
− Security Alerts are released as necessary
− Based off the previous (non-CPU) release
− Released simultaneously on java.com and OTN
JDK 10.0.1 - Security Baselines
JRE Family Version
JRE Security Baseline
(Full Version String)
10 10.0.1+10
9 9.0.99
8 1.8.0_171-b11
7 1.7.0_181-b09
6 1.6.0_191-b09
JDK Version Numbers and Java Critical Patch Updates
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
A version number, $VNUM, is a sequence of numerals of arbitrary length, separated by period characters.
The first four numerals are interpreted as follows: $FEATURE.$INTERIM.$UPDATE.$EMERG
$FEATURE formerly $MAJOR
$INTERIM formerly $MINOR
$UPDATE formerly $SECURITY
$EMERG -- The emergency-release counter, incremented only when it's necessary to produce an
emergency release to fix an urgent security issue. Using an additional numeral for this purpose minimizes
the disruption to both developers and users of in-flight update releases.
JDK Version Numbers
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java in a World of Containers
and Open Source
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java in a World of Containers
Java’s characteristic make it ideal for a container environment
7
• Managed language/runtime
• Hardware and operating system agnostic
• Safety and secure enforced by JVM
• Compatibility is a key design goal
• JVM ensures stable execution when runtime environment changes
• Broad ecosystem
• Keeping Java the first choice for container deployments
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Open source commercial features
What is being open-sourced in Java
8
• Java Mission Control
– Monitor and manage Java applications with minimal performance overhead
• Java Flight Recorder
– Collects diagnostic and profiling data about a running Java application
• Application Class Data Sharing
– Enables you to place classes from the standard extensions directories and the
application class path in the shared archive
• Java Usage Tracker
– Tracks how the JRE‘s are being used in your systems
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 Migration Guide
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Migrating to Oracle JDK 10 - Migration Guide (1)
https://docs.oracle.com/javase/10/migrate/
10
• Migrating to JDK 10 from JDK 8
– The purpose of this guide is to help you identify potential issues and give you suggestions on how to
proceed as you migrate your existing Java application from JDK 8, or earlier version of the JDK, to JDK 10
– This guide is not significantly different than the JDK 9 Migration Guide
– Every new Java SE release introduces some binary, source, and behavioral incompatibilities with previous
releases
– The modularization of the Java SE Platform that happened in JDK 9 brought many benefits, but also many
changes
– Code that uses only official Java SE Platform APIs and supported JDK-specific APIs should continue to work
without change
– Code that uses JDK-internal APIs should continue to run but should be migrated to use external APIs
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Migrating to Oracle JDK 10 - Migration Guide (2)
https://docs.oracle.com/javase/10/migrate/
11
• Prepare for Migration
• Download JDK 10
• Run Your Program Before Recompiling
• Update Third-Party Libraries
• Compile Your Application if Needed
• Run jdeps on Your Code
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Migrating to Oracle JDK 10 - Migration Guide (3)
https://docs.oracle.com/javase/10/migrate/
12
• Changes that you may encounter as you run your application
– New Version-String Scheme
– Understanding Runtime Access Warnings
– Changes to the Installed JDK/JRE Image
– Removed or Changed APIs
– Modules Shared with Java EE Not Resolved by Default
– Deployment
– Security Updates
– Changes to Garbage Collection
– Removed Tools and Components
– Removed macOS-Specific Features
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 Features
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 is the open-source reference implementation of
the Java SE 10 Platform as defined by JSR 383 in the JCP
14
• JEP 286: Local-Variable Type Inference
• JEP 296: Consolidate the JDK Forest into a Single Repository
• JEP 304: Garbage-Collector Interface
• JEP 307: Parallel Full GC for G1
• JEP 310: Application Class-Data Sharing
• JEP 312: Thread-Local Handshakes
• JEP 313: Remove the Native-Header Generation Tool (javah)
• JEP 314: Additional Unicode Language-Tag Extensions
• JEP316: Heap Allocation on Alternative Memory Devices
• JEP 317: Experimental Java-Based JIT Compiler
• JEP 319: Root Certificates
• JEP 322: Time-Based Release Versioning
http://openjdk.java.net/projects/jdk/10/
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 – JEP 286: Local-Variable Type Inference
Specification / language
15
• Enhance the Java Language to extend type inference to declarations of local
variables with initializers
• Restricted to local variables with initializers, indexes in the enhanced for-
loop, and locals declared in a traditional for-loop
• Not available for method formals, constructor formals, method return
types, fields, catch formals, or any other kind of variable declaration
var list = new ArrayList<String>();
var stream = list.stream();
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 – Type Inference in Java (1)
More than 15 years of Type Inference in Java
16
List<Block> blocks = List.of(…);
int maxWeight = blocks.stream()
.filter(block -> block.getColor() == BLUE)
.mapToInt(blue -> blue.getWeight())
.max();
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 – Type Inference in Java (2)
Local Variable Type Inference in Java
17
var stringList = new ArrayList<String>();
var stream = new stringList.stream();
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 – Type Inference in Java (3)
Local Variable Type Inference in Java
18
URL url = new URL(“http://www.oracle.com/“);
URLConnection conn = url.openConnection();
Reader reader = new InputStreamReader(conn.getInputStream());
var url = new URL(“http://www.oracle.com/“);
var conn = url.openConnection();
var reader = new InputStreamReader(conn.getInputStream());
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
• Reduces physical memory usage for loaded classes
• Faster startup time due to pre-loaded class metadata
• Shares of class metadata across JVM processes
• AppCDS stores class metadata in a Java Shared Archive file (JSA)
– bytecodes, field tables, method tables, etc.
• JVM was modified to load more efficiently these Shared Archive files
• Multiple JVM processes can memory-map the same JSA file
– Memory in the JSA file is shared across processes
– Memory is split into Read-Only (shared) and Read-Write (Copy-on-Write)
Application Class Data Sharing – AppCDS
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Application Class Data Sharing – Overview (1)
Without sharing
20
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Application Class Data Sharing – Overview (2)
With sharing
21
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Application Class Data Sharing – Savings
Large Web Applications
22
• Instantiates 13 JVM processes
• Average footprint savings: 5-10%
• Average start up savings: 10%
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 – JEP 319: Root Certificates
Security-libs / java.security
23
• Provide a default set of root Certification Authority (CA) certificates for the JDK
• Secure re-distribution rights for 80 Root Certificates from 17 Certificate
Authorities
• OpenJDK binaries can now connect to many TLS servers out-of-the-box
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK 10 – Project ZGC and OpenJDK EA binaries under GPL
Also opened since JavaOne 2017
24
• Project ZGC
– Scalable low latency garbage collector capable of handling heaps ranging from
gigabytes to terabytes in size, with GC pause times not exceeding 10ms
• OpenJDK Early Access binaries under GPL
– Feature releases (e.g. JDK 9, JDK 10, JDK 11)
– Project-specific binaries e.g. Project Valhalla
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Modularity
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Modular Development with the JDK
26
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Goals of the Java SE Module System (1)
• Reliable configuration with better maintenance
– replace the brittle, error-prone class-path mechanism with a means for program components to declare
explicit dependences upon one another
– Each modul exists once
– Verification of all necessary modules exist at start time
• Strong encapsulation
– allow a component to declare which of its public types are accessible to other components, and which
are not. Prevents access to non-public classes and API’s
– module can declare an API to other modules
– packages not on the API are hidden
• Addressing these goals would enable further benefits:
– A scalable platform for deployment of small applications and tiny runtime
– Greater platform integrity and Improved performance
27
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Non-Goals of the Java SE Module System (2)
• The Java Module System does not replace OSGi
• The Java Module System does not support versioning of modules
28
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• These are the final results of the Public Review Reconsideration Ballot for JSR #376.
• The EC has approved this ballot. The votes are below:
29
JSR 376: Java Module System (1)
Public Review Reconsideration Ballot from 2017-06-13 to 2017-06-26
On 2017-06-13 IBM voted Yes with the following comment:
IBM supports the revised JPMS specification moving to Proposed
Final Draft, with credit due to Oracle as the specification leader
and those in the JSR 376 Expert Group who dedicated their time to
reaching this milestone.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• Provide a means for developers and libraries to define their own modules
• Reflection API‘s for module information
• Integration with developer tools (Maven, Gradle, IDE‘s)
• Integration with existing package managers (e.g., RPM)
• Dynamic configuration of module graph (e.g., for Java EE containers)
• Documents, code, and builds
Requirements
The State of the Module System
Initial JLS and JVMS changes
API specification
java.lang.Class
java.lang.ClassLoader
java.lang.module
Issue summary
30
JSR 376: Java Module System (2)
An approachable yet scalable module system for the Java Platform
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JEP 200: The Modular JDK (1)
• can contain class files, resources, and related native and configuration files.
• has a name.
• can depend, by module name, upon one or more other modules.
• can export all of the public types in one or more of the API packages that it contains, making them
available to code in other modules depending on it
• can restrict, by module name, the set of modules to which the public types in one or more of its API
packages are exported. (sharing internal interface)
• can re-export all of the public types that are exported by one or more of the modules upon which it
depends. (support refactoring & aggregation)
A module is a set of packages with classes & interfaces
The module metadata is in module-info.class
31
Module System Assumptions: A module …
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JEP 200: The Modular JDK (2)
• Standard modules, whose specifications are governed by the JCP, must
have names starting with the string "java.".
• All other modules are merely part of the JDK, and must have names
starting with the string "jdk.".
• If a module exports a type that contains a public or protected member
that, in turn, refers to a type from some other module then the first
module must re-export the public types of the second. This ensures that
method-invocation chaining works in the obvious way.
• Additional principles in JEP 200 text to ensure that code which depends
only upon Java SE modules will depend only upon standard Java SE types.
32
Design Principles
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Modules
• A module is a named, self-describing collection of code & data
– Code is organized as a set of packages containing types
• It declares which other modules it requires in order to be compiled and run
• It declares which of its packages it exports.
• Module system locates modules
– Ensures code in a module can only refer to types in modules upon which it depends
– The access-control mechanisms of the Java language and the Java virtual machine
prevent code from accessing types in packages that are not exported by their defining
modules.
33
A fundamental new kind of Java component
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Module descriptors
• class files already have a precisely-defined and extensible format
• consider module-info.class file as module descriptor
– includes the compiled forms of source-level module declarations
– may include additional kinds of information recorded in class-file attributes
• inserted after the declaration is initially compiled.
• An IDE can insert class file attributes containing documentary information
– module version, title, description, and license.
• This information can be read at compile time and run time
– for use in documentation, diagnosis, and debugging
34
module-info.class advantages
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Platform modules
• The only module known specifically to the module system is java.base.
– The base module is always present. Every other module depends implicitly upon the
base module, while the base module depends upon no other modules
• The base module defines and exports all of the platform’s core packages,
including the module system itself:
module java.base {
exports java.io;
exports java.lang;
exports java.lang.module;
... }
35
Modules all the way down to the base module: java.base
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Module Paths
• module system can select a module to resolve a dependence
– built-in to the compile-time or run-time environment or
– a module defined in an artifact
• the module system locates artifacts on one or more module paths defined by the host system.
• A module path is a sequence of directories containing module artifacts
– searched, in order, for the first artifact that defines a suitable module.
• Module paths are materially different from class paths, and more robust:
– A class path is a means to locate individual types in all the artifacts on the path.
– A module path is a means to locate whole modules rather than individual types.
• If a particular dependence can not be fulfilled then resolution will fail with an error message
36
Where do modules fulfilling dependences come from?
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Packages and Modules - Module Declarations
37
ModuleDirective:
requires {RequiresModifier} ModuleName ;
exports PackageName [to ModuleName {, ModuleName}] ;
opens PackageName [to ModuleName {, ModuleName}] ;
uses TypeName ;
provides TypeName with TypeName {, TypeName} ;
Java Language Specification, Java SE 9 Edition
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Services (1)
• Our com.foo.app module extended to use a MySQL database
– a MySQL JDBC driver implementing java.sql.Driver is provided in a module:
module com.mysql.jdbc {
requires java.sql;
requires org.slf4j;
exports com.mysql.jdbc;
}
38
Loose coupling
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Services (2)
• In order for the java.sql module to make use of this driver we must
– add the driver module to the run-time module graph
– resolve its dependences
• java.util.ServiceLoader class can instantiate the driver class via reflection
39
Loose coupling
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Services (3)
• Module system must be able to locate service providers.
• Services provided are declared with a provides clause:
module com.mysql.jdbc {
requires java.sql;
requires org.slf4j;
exports com.mysql.jdbc;
provides java.sql.Driver with com.mysql.jdbc.Driver;
}
40
Loose coupling
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Services (4)
• Module system must be able to locate service users.
• Services used are declared with a uses clause:
module java.sql {
requires public java.logging;
requires public java.xml;
exports java.sql;
exports javax.sql;
exports javax.transaction.xa;
uses java.sql.Driver;
}
41
Loose coupling
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Services (5)
• Clarity
• Service declarations can be interpreted at compile time
– to ensure that the service interface is accessible
– to ensure that providers actually do implement their declared service interfaces
– to ensure that observable providers are appropriately compiled and linked prior to
run time
• Catching runtime problems at compile time!
42
Advantages of using module declations to declare service relationships
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Class Loaders
• Few restrictions on the relationships between modules and class loaders:
– A class loader can load types from one module or from many modules
• as long the modules do not interfere with each other and
• the types in any particular module are loaded by just one loader
• Critical to compatibility
– retains the existing hierarchy of built-in class loaders.
• Easier to modularize existing applications with complex class loaders
– class loaders can be upgraded to load types in modules
– without necessarily changing their delegation patterns
43
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Modular Class Loading in the JDK
44
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Layers
45
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Layer creation
46
(2)
String moduleName -> {
switch (moduleName) {
case “java.base“:
case “java.logging“:
return BOOTSTRAP_LDR;
default:
return APP_LDR;
}
}
(1)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Unnamed Modules
• Every class loader has a unique unnamed module
– returned by the new ClassLoader::getUnnamedModule method
• A class loader loads a type not defined in a named module
– that type is considered to be in the unnamed module
• An unnamed module
– reads every other module
– exports all of its packages to every other module
• Existing class-path applications using only standard APIs can keep working
47
Backwards compatibility: Loading types from the class path
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Während der Übergangszeit bleibt diese Hintertür offen
At your own risk: java launcher and javac option, as part of JEP 261: Module System
48
• --add-exports <source-module>/<package>=<target-module>(,<target-module>)*
where <source-module> and <target-module> are module names and <package> is the name of a package
• --add-exports java.management/com.sun.jmx.remote.internal=jmx.wbtest
• --add-exports java.management/sun.management=ALL-UNNAMED
The --add-exports option must be used with great care. You can use it to gain access to an internal API of
a library module, or even of the JDK itself, but you do so at your own risk: If that internal API changes or
is removed then your library or application will fail.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java Module System and Tools
• jimage
• jdeps
• jlink
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 50
jimage – Modulverzeichnis-Kommando (1)
C:jdk-10> java –version
java 10.0.1 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
C:jdk-10lib> jimage info modules
C:jdk-10lib> jimage list modules
/* list all JDK 10 *.class files from the modules file */
C:jdk-10lib> jimage extract --dir=C:jdk-10mydir modules
/* extract all JDK 10 *.class files from the libmodules file */
C:jdk-10> java --list-modules
/* list the JDK 10 modules */
Tools should never read jimage files, directly or via code. It’s an JVM-internal format ..
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 51
jimage – Modulverzeichnis-Kommando (2)
• JIMAGE Format
Schneller Zugriff auf die im JDK 10 enthaltene Klassen
Kein langsames Durchsuchen von ZIP-Einträgen
JIMAGE für beschleunigtes Klassenladen innerhalb vom JDK
• JMOD Format
Basiert auf dem ZIP-Format, wie das JAR-Format
Für modulspezifische Metadaten und plattformspezifische Bibliotheken (DLL‘s oder SO-Files)
JMOD Format soll künftig Ersatz für das JAR-Format werden, damit komplette Java-Anwendungen als Modul ausgeliefert werden
können, inklusive allen Metadaten von Abhängigkeiten und exportierten API‘s
Anwendungs-Rollout mit abgespeckter JRE, nur mit den benötigten Modulen
Q: Without it, how can org.reflections and scannotations efficiently find all classes that have specific annotation?
A: Tools should use the jrt filesystem to scan classes in the image. Details in JEP 220: http://openjdk.java.net/jeps/220
Tools should never read jimage files, directly or via code. It’s an JVM-internal format ..
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 52
jdeps - Java-Class-Dependency-Analyzer
C:mlib> jdeps -profile com.greetings.jar
com.greetings
[file:///C:/mlib/com.greetings.jar]
requires mandated java.base (@9-ea)
com.greetings -> java.base (compact1)
com.greetings -> java.io compact1
com.greetings -> java.lang compact1
C:mlib> jdeps -v com.greetings.jar
com.greetings
[file:///C:/mlib/com.greetings.jar]
requires mandated java.base (@9-ea)
com.greetings -> java.base
com.greetings.Main -> java.io.PrintStream java.base
com.greetings.Main -> java.lang.Object java.base
com.greetings.Main -> java.lang.String java.base
com.greetings.Main -> java.lang.System java. base
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
jdeps - Java-Class-Dependency-Analyzer JDK 10.0.1 (1)
C:jdk-10JavaFXApplication9dist> jdeps -profile JavaFXApplication9.jar
JavaFXApplication9.jar -> java.base (compact1)
JavaFXApplication9.jar -> javafx.base (javafx.base)
JavaFXApplication9.jar -> javafx.controls (javafx.controls)
JavaFXApplication9.jar -> javafx.graphics (javafx.graphics)
javafxapplication9 -> java.io compact1
javafxapplication9 -> java.lang compact1
javafxapplication9 -> javafx.application
javafxapplication9 -> javafx.collections
javafxapplication9 -> javafx.event
javafxapplication9 -> javafx.scene
javafxapplication9 -> javafx.scene.control
javafxapplication9 -> javafx.scene.layout
javafxapplication9 -> javafx.stage
C:jdk-10JavaFXApplication3dist> jdeps -v JavaFXApplication9.jar
C:jdk-10JavaFXApplication9dist> jdeps --generate-module-info C:jdk-10JavaFXApplication9dist
c:jdk-10JavaFXApplication9distJavaFXApplication9.jar
writing to C:jdk-10JavaFXApplication9distJavaFXApplication9module-info.java
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
jdeps - Java-Class-Dependency-Analyzer JDK 10.0.1 (2)
C:jdk-10JavaFXApplication9dist> jdeps --generate-module-info C:jdk-10JavaFXApplication9dist
c:jdk-10JavaFXApplication9distJavaFXApplication9.jar
writing to C:jdk-10JavaFXApplication9distJavaFXApplication9module-info.java
C:jdk-10JavaFXApplication9distJavaFXApplication9> dir
18.04.2018 19:12 171 module-info.java
C:jdk-10JavaFXApplication9distJavaFXApplication9> type module-info.java
module JavaFXApplication9 {
requires javafx.base;
requires javafx.controls;
requires transitive javafx.graphics;
exports javafxapplication9;
}
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
jdeps - Java-Class-Dependency-Analyzer JDK 10.0.1 (3)
C:jdk-10JavaFXApplication9dist> jdeps --module-path C:jdk-10JavaFXApplication9dist -s -
dotoutput c:jdk-10JavaFXApplication9dist c:jdk-10JavaFXApplication9distJavaFXApplication9.jar
C:jdk-10JavaFXApplication9dist> type summary.dot
digraph "summary" {
"JavaFXApplication9.jar" -> "java.base (java.base)";
"JavaFXApplication9.jar" -> "javafx.base (javafx.base)";
"JavaFXApplication9.jar" -> "javafx.controls (javafx.controls)";
"JavaFXApplication9.jar" -> "javafx.graphics (javafx.graphics)";
}
http://www.webgraphviz.com/
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 56
Additional diagnostic options supported by the launcher include
java --show-module-resolution to show module resolution output during startup, and
causes the module system to describe its activities as it constructs the initial module graph
C:jdk-10> java --show-module-resolution|more
root jdk.management.jfr jrt:/jdk.management.jfr
root javafx.web jrt:/javafx.web
root jdk.xml.dom jrt:/jdk.xml.dom
root jdk.jfr jrt:/jdk.jfr
root jdk.httpserver jrt:/jdk.httpserver
root javafx.base jrt:/javafx.base
root jdk.net jrt:/jdk.net
root javafx.controls jrt:/javafx.controls
root jdk.management.resource jrt:/jdk.management.resource
root java.se jrt:/java.se
root jdk.management.cmm jrt:/jdk.management.cmm
root jdk.jsobject jrt:/jdk.jsobject
root javafx.swing jrt:/javafx.swing
root jdk.sctp jrt:/jdk.sctp
root oracle.desktop jrt:/oracle.desktop
root jdk.unsupported jrt:/jdk.unsupported
root jdk.scripting.nashorn jrt:/jdk.scripting.nashorn
root oracle.net jrt:/oracle.net
root jdk.management jrt:/jdk.management
root javafx.graphics jrt:/javafx.graphics
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 57
jlink - generiert JRE und Applikations-Images (1)
• Platzsparende Runtime, inklusive eigener Anwendungsmodule im frei wählbaren Verzeichnis
jlink <options> --module-path <modulepath> --output <path>
jlink --module-path $JDKMODS:mlib --add-modules myapp --output myimage
C:> C:jdk-10binjlink --module-path C:jdk-10jmods;mlib --add-modules com.greetings --
compress=2 --verbose --output greetingsapplication
com.greetings file:///C:/mlib/com.greetings.jar
java.base file:///C:/jdk-10/jmods/java.base.jmod
Providers: java.base provides java.nio.file.spi.FileSystemProvider used by java.base
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 58
jlink - generiert JRE und Applikations-Images (2)
• Image-Verzeichnis C:greetingsapplication 24,7 MB
• Datei release mit früherem „build 9-ea+142-jigsaw-nightly-h5677-20161102”
C:greetingsapplication> dir
Directory of C:greetingsapplication
18.04.2018 15:50 <DIR> .
18.04.2018 15:50 <DIR> ..
18.04.2018 15:50 <DIR> bin
18.04.2018 15:50 <DIR> conf
18.04.2018 15:50 <DIR> include
18.04.2018 15:50 <DIR> legal
18.04.2018 15:50 <DIR> lib
18.04.2018 15:50 58 release
#Thu Mar 09 22:11:23 CET 2017
OS_NAME="Windows"
MODULES="java.base com.greetings"
OS_VERSION="5.1"
OS_ARCH="i586"
JAVA_VERSION="9"
JAVA_FULL_VERSION="9-ea"
• Datei release „10.0.1“
JAVA_VERSION="10.0.1"
MODULES="java.base com.greetings"
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 59
jlink - generiert JRE und Applikations-Images (3)
• Image-Verzeichnis C:greetingsapplication 24,7 MB
C:greetingsapplicationbin> java -m com.greetings/com.greetings.Main
Greetings!
C:greetingsapplicationbin> dir
18.04.2018 15:50 143.360 java.dll
18.04.2018 15:50 225.280 java.exe
18.04.2018 15:50 225.280 javaw.exe
18.04.2018 15:50 19.968 jimage.dll
18.04.2018 15:50 194.560 jli.dll
18.04.2018 15:50 10.752 keytool.exe
18.04.2018 15:50 660.128 msvcp120.dll
18.04.2018 15:50 963.232 msvcr120.dll
18.04.2018 15:50 89.088 net.dll
18.04.2018 15:50 53.760 nio.dll
18.04.2018 15:50 <DIR> server
18.04.2018 15:50 43.008 verify.dll
18.04.2018 15:50 70.144 zip.dll
C:mlib> java -jar com.greetings.jar
Greetings!
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 60
jlink - generiert JRE und Applikations-Images (4)
• Image-Verzeichnis C:greetingsapplication 24,7 MB
C:greetingsapplicationbin> java -m com.greetings/com.greetings.Main
Greetings!
C:greetingsapplicationbin> java --show-module-resolution -m com.greetings/com.greetings.Main
root com.greetings jrt:/com.greetings
Greetings!
C:greetingsapplicationbin> java --list-modules -m com.greetings/com.greetings.Main
com.greetings
java.base@10.0.1
C:greetingsapplicationbin> java -verbose -m com.greetings/com.greetings.Main
...
[1.418s][info][class,load] java.nio.charset.CoderResult$2 source: jrt:/java.base
Greetings!
[1.424s][info][class,load] java.lang.Shutdown source: jrt:/java.base
[1.425s][info][class,load] java.lang.Shutdown$Lock source: jrt:/java.base
C:greetingsapplicationbin>
java --add-exports java.base/jdk.internal.ref=ALL-UNNAMED -m com.greetings/com.greetings.Main
Greetings!
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• Sources per JDK
service
java ..
java-8 ..
java-10
org.gradle.example.service
Service10
• Dependencies per JDK
sources {
java8 ..
java10 {
dependencies {
library ‘org.apache.httpcomponents:httpclient:4.5.1‘
}
}
}
61
JSR 376: Java Module System – Gradle (1)
Integration with developer tools (Maven, Gradle, IDE‘s)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• JEP 238: Multi-Release JAR
jar root
– A.class
– B.class
– C.class
– D.class
– META-INF
– versions
– 8
– A.class
– B.class
– 9
– A.class
– 10
– A.class
62
JSR 376: Java Module System – Gradle (2)
Integration with developer tools (Maven, Gradle, IDE‘s)
• A multi-release JAR "MRJAR" will contain
additional directories for classes and resources
specific to particular Java platform releases.
• A JAR for a typical library might look like this:
jar root
– A.class
– B.class
– C.class
– D.class
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 63
JSR 376: Java Module System – NetBeans IDE (1)
Integration with developer tools (Maven, Gradle, IDE‘s)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 64
JSR 376: Java Module System – NetBeans IDE (2)
Integration with developer tools (Maven, Gradle, IDE‘s)
http://bits.netbeans.org/download/trunk/nightly/latest/
C:Program FilesNetBeans Dev 201703140002
JDK 10.0.1 64-bit
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Summary
65
Das Java Module System bringt viele Vorteile, aber auch größere Änderungen
Existierender Anwendungs-Code, der nur offizielle Java SE Plattform-API‘s mit den
unterstützten JDK-spezifischen API’s verwendet, soll auch weiterhin ohne Änderungen
ablauffähig sein
Abwärtskompatibilität
Dennoch ist es wahrscheinlich, wenn weiterhin veraltete Funktionalität oder JDK-interne API’s
verwendet werden, dass der Code unverträglich sein kann
Entwickler sollten sich frühzeitig damit vertraut machen, wie existierende Bibliotheken &
Anwendungen auf das aktuelle JDK anzupassen sind, wie sie modularisiert werden, welche
Designfragen zu klären sind und wie man vorhandenen Anwendungs-Code trotzdem mit
JDK 10 zum Laufen bekommt, auch wenn man den Code nicht verändern kann
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Thanks!
Wolfgang.Weigend@oracle.com
Twitter: @wolflook
66

More Related Content

What's hot

General Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevGeneral Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevOracle Developers
 
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)Fred Rowe
 
JSF 2.2 Input Output JavaLand 2015
JSF 2.2 Input Output JavaLand 2015JSF 2.2 Input Output JavaLand 2015
JSF 2.2 Input Output JavaLand 2015Edward Burns
 
JavaOne 2014 Java EE 8 Booth Slides
JavaOne 2014 Java EE 8 Booth SlidesJavaOne 2014 Java EE 8 Booth Slides
JavaOne 2014 Java EE 8 Booth SlidesEdward Burns
 
Adopt-a-JSR for JSON Processing 1.1, JSR 374
Adopt-a-JSR for JSON Processing 1.1, JSR 374Adopt-a-JSR for JSON Processing 1.1, JSR 374
Adopt-a-JSR for JSON Processing 1.1, JSR 374Heather VanCura
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12Simon Ritter
 
Introduce yourself to java 17
Introduce yourself to java 17Introduce yourself to java 17
Introduce yourself to java 17ankitbhandari32
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Edward Burns
 
OOW15 - Getting Optimal Performance from Oracle E-Business Suite
OOW15 - Getting Optimal Performance from Oracle E-Business SuiteOOW15 - Getting Optimal Performance from Oracle E-Business Suite
OOW15 - Getting Optimal Performance from Oracle E-Business Suitevasuballa
 
JavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkJavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkStephen Chin
 
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and MorePolyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and MoreShaun Smith
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Edward Burns
 
MySQL High Availability Solutions - Feb 2015 webinar
MySQL High Availability Solutions - Feb 2015 webinarMySQL High Availability Solutions - Feb 2015 webinar
MySQL High Availability Solutions - Feb 2015 webinarAndrew Morgan
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Shaun Smith
 
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsOracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsChris Muir
 
JavaOne2015報告会 in Okinawa
JavaOne2015報告会 in OkinawaJavaOne2015報告会 in Okinawa
JavaOne2015報告会 in OkinawaTakashi Ito
 
Ed presents JSF 2.2 at a 2013 Gameduell Tech talk
Ed presents JSF 2.2 at a 2013 Gameduell Tech talkEd presents JSF 2.2 at a 2013 Gameduell Tech talk
Ed presents JSF 2.2 at a 2013 Gameduell Tech talkEdward Burns
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemBruno Borges
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondSimon Ritter
 

What's hot (20)

General Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevGeneral Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajev
 
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDKComparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK
 
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
 
JSF 2.2 Input Output JavaLand 2015
JSF 2.2 Input Output JavaLand 2015JSF 2.2 Input Output JavaLand 2015
JSF 2.2 Input Output JavaLand 2015
 
JavaOne 2014 Java EE 8 Booth Slides
JavaOne 2014 Java EE 8 Booth SlidesJavaOne 2014 Java EE 8 Booth Slides
JavaOne 2014 Java EE 8 Booth Slides
 
Adopt-a-JSR for JSON Processing 1.1, JSR 374
Adopt-a-JSR for JSON Processing 1.1, JSR 374Adopt-a-JSR for JSON Processing 1.1, JSR 374
Adopt-a-JSR for JSON Processing 1.1, JSR 374
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12
 
Introduce yourself to java 17
Introduce yourself to java 17Introduce yourself to java 17
Introduce yourself to java 17
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015
 
OOW15 - Getting Optimal Performance from Oracle E-Business Suite
OOW15 - Getting Optimal Performance from Oracle E-Business SuiteOOW15 - Getting Optimal Performance from Oracle E-Business Suite
OOW15 - Getting Optimal Performance from Oracle E-Business Suite
 
JavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkJavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring Framework
 
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and MorePolyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.
 
MySQL High Availability Solutions - Feb 2015 webinar
MySQL High Availability Solutions - Feb 2015 webinarMySQL High Availability Solutions - Feb 2015 webinar
MySQL High Availability Solutions - Feb 2015 webinar
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019
 
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsOracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
 
JavaOne2015報告会 in Okinawa
JavaOne2015報告会 in OkinawaJavaOne2015報告会 in Okinawa
JavaOne2015報告会 in Okinawa
 
Ed presents JSF 2.2 at a 2013 Gameduell Tech talk
Ed presents JSF 2.2 at a 2013 Gameduell Tech talkEd presents JSF 2.2 at a 2013 Gameduell Tech talk
Ed presents JSF 2.2 at a 2013 Gameduell Tech talk
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 

Similar to JDK 10 Java Module System

JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKWolfgang Weigend
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsDavid Delabassee
 
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"GlobalLogic Ukraine
 
55 New Features in Java SE 8
55 New Features in Java SE 855 New Features in Java SE 8
55 New Features in Java SE 8Simon Ritter
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best PracticesDavid Delabassee
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsDavid Delabassee
 
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 201310 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013Martin Fousek
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesMert Çalışkan
 
Java: how to thrive in the changing world
Java: how to thrive in the changing worldJava: how to thrive in the changing world
Java: how to thrive in the changing worldAlexey Fyodorov
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8jclingan
 
Java and Serverless - A Match Made In Heaven, Part 1
Java and Serverless - A Match Made In Heaven, Part 1Java and Serverless - A Match Made In Heaven, Part 1
Java and Serverless - A Match Made In Heaven, Part 1Curity
 
Introduction to Java Micro Edition (ME) 8
Introduction to Java Micro Edition (ME) 8Introduction to Java Micro Edition (ME) 8
Introduction to Java Micro Edition (ME) 8terrencebarr
 

Similar to JDK 10 Java Module System (20)

JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDK
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
 
55 New Features in Java SE 8
55 New Features in Java SE 855 New Features in Java SE 8
55 New Features in Java SE 8
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Javantura v6 - JDK 11 & JDK 12 - Dalibor Topic
Javantura v6 - JDK 11 & JDK 12 - Dalibor TopicJavantura v6 - JDK 11 & JDK 12 - Dalibor Topic
Javantura v6 - JDK 11 & JDK 12 - Dalibor Topic
 
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
 
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 201310 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
Java: how to thrive in the changing world
Java: how to thrive in the changing worldJava: how to thrive in the changing world
Java: how to thrive in the changing world
 
Java EE for the Cloud
Java EE for the CloudJava EE for the Cloud
Java EE for the Cloud
 
Java 101
Java 101Java 101
Java 101
 
Java 8
Java 8Java 8
Java 8
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8
 
Java SE Subscription Workshop
Java SE Subscription WorkshopJava SE Subscription Workshop
Java SE Subscription Workshop
 
Java and Serverless - A Match Made In Heaven, Part 1
Java and Serverless - A Match Made In Heaven, Part 1Java and Serverless - A Match Made In Heaven, Part 1
Java and Serverless - A Match Made In Heaven, Part 1
 
Introduction to Java Micro Edition (ME) 8
Introduction to Java Micro Edition (ME) 8Introduction to Java Micro Edition (ME) 8
Introduction to Java Micro Edition (ME) 8
 

More from Wolfgang Weigend

It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15
It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15
It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15Wolfgang Weigend
 
The JDK 8 end of public updates and the Java SE subscription
The JDK 8 end of public updates and the Java SE subscription The JDK 8 end of public updates and the Java SE subscription
The JDK 8 end of public updates and the Java SE subscription Wolfgang Weigend
 
fn project serverless computing
fn project serverless computingfn project serverless computing
fn project serverless computingWolfgang Weigend
 
Development with JavaFX 9 in JDK 9.0.1
Development with JavaFX 9 in JDK 9.0.1Development with JavaFX 9 in JDK 9.0.1
Development with JavaFX 9 in JDK 9.0.1Wolfgang Weigend
 
Java Flight Recorder Javamagazin May 2017
Java Flight Recorder Javamagazin May 2017Java Flight Recorder Javamagazin May 2017
Java Flight Recorder Javamagazin May 2017Wolfgang Weigend
 
Javamagazin 1.2016 jdk9_ea_b83_jigsaw
Javamagazin 1.2016 jdk9_ea_b83_jigsawJavamagazin 1.2016 jdk9_ea_b83_jigsaw
Javamagazin 1.2016 jdk9_ea_b83_jigsawWolfgang Weigend
 
Das 1×1 des java supports wie die wartung älterer jdk-versionen weitergeht
Das 1×1 des java supports wie die wartung älterer jdk-versionen weitergehtDas 1×1 des java supports wie die wartung älterer jdk-versionen weitergeht
Das 1×1 des java supports wie die wartung älterer jdk-versionen weitergehtWolfgang Weigend
 
Automated testing of JavaFX GUI components
Automated testing of JavaFX GUI componentsAutomated testing of JavaFX GUI components
Automated testing of JavaFX GUI componentsWolfgang Weigend
 
Java mission control and java flight recorder
Java mission control and java flight recorderJava mission control and java flight recorder
Java mission control and java flight recorderWolfgang Weigend
 
Automated testing of JavaFX UI components
Automated testing of JavaFX UI componentsAutomated testing of JavaFX UI components
Automated testing of JavaFX UI componentsWolfgang Weigend
 
Java magazin9 2012_wls 12c_das_dutzend_ist_voll
Java magazin9 2012_wls 12c_das_dutzend_ist_vollJava magazin9 2012_wls 12c_das_dutzend_ist_voll
Java magazin9 2012_wls 12c_das_dutzend_ist_vollWolfgang Weigend
 
Jm 10.13 weigend_lagergren_nashorn
Jm 10.13 weigend_lagergren_nashornJm 10.13 weigend_lagergren_nashorn
Jm 10.13 weigend_lagergren_nashornWolfgang Weigend
 
Article - JDK 8 im Fokus der Entwickler
Article - JDK 8 im Fokus der EntwicklerArticle - JDK 8 im Fokus der Entwickler
Article - JDK 8 im Fokus der EntwicklerWolfgang Weigend
 

More from Wolfgang Weigend (14)

It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15
It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15
It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15
 
The JDK 8 end of public updates and the Java SE subscription
The JDK 8 end of public updates and the Java SE subscription The JDK 8 end of public updates and the Java SE subscription
The JDK 8 end of public updates and the Java SE subscription
 
fn project serverless computing
fn project serverless computingfn project serverless computing
fn project serverless computing
 
Development with JavaFX 9 in JDK 9.0.1
Development with JavaFX 9 in JDK 9.0.1Development with JavaFX 9 in JDK 9.0.1
Development with JavaFX 9 in JDK 9.0.1
 
Java Flight Recorder Javamagazin May 2017
Java Flight Recorder Javamagazin May 2017Java Flight Recorder Javamagazin May 2017
Java Flight Recorder Javamagazin May 2017
 
Javamagazin 1.2016 jdk9_ea_b83_jigsaw
Javamagazin 1.2016 jdk9_ea_b83_jigsawJavamagazin 1.2016 jdk9_ea_b83_jigsaw
Javamagazin 1.2016 jdk9_ea_b83_jigsaw
 
Das 1×1 des java supports wie die wartung älterer jdk-versionen weitergeht
Das 1×1 des java supports wie die wartung älterer jdk-versionen weitergehtDas 1×1 des java supports wie die wartung älterer jdk-versionen weitergeht
Das 1×1 des java supports wie die wartung älterer jdk-versionen weitergeht
 
Automated testing of JavaFX GUI components
Automated testing of JavaFX GUI componentsAutomated testing of JavaFX GUI components
Automated testing of JavaFX GUI components
 
Java mission control and java flight recorder
Java mission control and java flight recorderJava mission control and java flight recorder
Java mission control and java flight recorder
 
Automated testing of JavaFX UI components
Automated testing of JavaFX UI componentsAutomated testing of JavaFX UI components
Automated testing of JavaFX UI components
 
Java magazin9 2012_wls 12c_das_dutzend_ist_voll
Java magazin9 2012_wls 12c_das_dutzend_ist_vollJava magazin9 2012_wls 12c_das_dutzend_ist_voll
Java magazin9 2012_wls 12c_das_dutzend_ist_voll
 
JavaFX goes open source
JavaFX goes open sourceJavaFX goes open source
JavaFX goes open source
 
Jm 10.13 weigend_lagergren_nashorn
Jm 10.13 weigend_lagergren_nashornJm 10.13 weigend_lagergren_nashorn
Jm 10.13 weigend_lagergren_nashorn
 
Article - JDK 8 im Fokus der Entwickler
Article - JDK 8 im Fokus der EntwicklerArticle - JDK 8 im Fokus der Entwickler
Article - JDK 8 im Fokus der Entwickler
 

Recently uploaded

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 

Recently uploaded (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 

JDK 10 Java Module System

  • 1. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Title Slide with Java FY15 Theme Subtitle Presenter’s Name Presenter’s Title Organization, Division or Business Unit Month 00, 2014 Note: The speaker notes for this slide include detailed instructions on how to reuse this Title Slide in another presentation. Tip! Remember to remove this text box. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. JDK 10 features Java Module System Wolfgang Weigend Sen. Leitender Systemberater Java Technology and Architecture
  • 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Agenda Java Version Numbers Java in a World of Containers and Open Source JDK 10 Migration Guide JDK 10 Features Modularity Java Module System and Tools Summary 1 2 3 4 3 5 6 7
  • 4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Rules for Java CPU’s − Main release for security vulnerabilities − Covers all JDK families (10, 9, 8, 7, 6) − CPU release triggers Auto-update − Dates published 12 months in advance − Security Alerts are released as necessary − Based off the previous (non-CPU) release − Released simultaneously on java.com and OTN JDK 10.0.1 - Security Baselines JRE Family Version JRE Security Baseline (Full Version String) 10 10.0.1+10 9 9.0.99 8 1.8.0_171-b11 7 1.7.0_181-b09 6 1.6.0_191-b09 JDK Version Numbers and Java Critical Patch Updates
  • 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | A version number, $VNUM, is a sequence of numerals of arbitrary length, separated by period characters. The first four numerals are interpreted as follows: $FEATURE.$INTERIM.$UPDATE.$EMERG $FEATURE formerly $MAJOR $INTERIM formerly $MINOR $UPDATE formerly $SECURITY $EMERG -- The emergency-release counter, incremented only when it's necessary to produce an emergency release to fix an urgent security issue. Using an additional numeral for this purpose minimizes the disruption to both developers and users of in-flight update releases. JDK Version Numbers
  • 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Java in a World of Containers and Open Source
  • 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Java in a World of Containers Java’s characteristic make it ideal for a container environment 7 • Managed language/runtime • Hardware and operating system agnostic • Safety and secure enforced by JVM • Compatibility is a key design goal • JVM ensures stable execution when runtime environment changes • Broad ecosystem • Keeping Java the first choice for container deployments
  • 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Open source commercial features What is being open-sourced in Java 8 • Java Mission Control – Monitor and manage Java applications with minimal performance overhead • Java Flight Recorder – Collects diagnostic and profiling data about a running Java application • Application Class Data Sharing – Enables you to place classes from the standard extensions directories and the application class path in the shared archive • Java Usage Tracker – Tracks how the JRE‘s are being used in your systems
  • 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 Migration Guide
  • 10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Migrating to Oracle JDK 10 - Migration Guide (1) https://docs.oracle.com/javase/10/migrate/ 10 • Migrating to JDK 10 from JDK 8 – The purpose of this guide is to help you identify potential issues and give you suggestions on how to proceed as you migrate your existing Java application from JDK 8, or earlier version of the JDK, to JDK 10 – This guide is not significantly different than the JDK 9 Migration Guide – Every new Java SE release introduces some binary, source, and behavioral incompatibilities with previous releases – The modularization of the Java SE Platform that happened in JDK 9 brought many benefits, but also many changes – Code that uses only official Java SE Platform APIs and supported JDK-specific APIs should continue to work without change – Code that uses JDK-internal APIs should continue to run but should be migrated to use external APIs
  • 11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Migrating to Oracle JDK 10 - Migration Guide (2) https://docs.oracle.com/javase/10/migrate/ 11 • Prepare for Migration • Download JDK 10 • Run Your Program Before Recompiling • Update Third-Party Libraries • Compile Your Application if Needed • Run jdeps on Your Code
  • 12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Migrating to Oracle JDK 10 - Migration Guide (3) https://docs.oracle.com/javase/10/migrate/ 12 • Changes that you may encounter as you run your application – New Version-String Scheme – Understanding Runtime Access Warnings – Changes to the Installed JDK/JRE Image – Removed or Changed APIs – Modules Shared with Java EE Not Resolved by Default – Deployment – Security Updates – Changes to Garbage Collection – Removed Tools and Components – Removed macOS-Specific Features
  • 13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 Features
  • 14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 is the open-source reference implementation of the Java SE 10 Platform as defined by JSR 383 in the JCP 14 • JEP 286: Local-Variable Type Inference • JEP 296: Consolidate the JDK Forest into a Single Repository • JEP 304: Garbage-Collector Interface • JEP 307: Parallel Full GC for G1 • JEP 310: Application Class-Data Sharing • JEP 312: Thread-Local Handshakes • JEP 313: Remove the Native-Header Generation Tool (javah) • JEP 314: Additional Unicode Language-Tag Extensions • JEP316: Heap Allocation on Alternative Memory Devices • JEP 317: Experimental Java-Based JIT Compiler • JEP 319: Root Certificates • JEP 322: Time-Based Release Versioning http://openjdk.java.net/projects/jdk/10/
  • 15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 – JEP 286: Local-Variable Type Inference Specification / language 15 • Enhance the Java Language to extend type inference to declarations of local variables with initializers • Restricted to local variables with initializers, indexes in the enhanced for- loop, and locals declared in a traditional for-loop • Not available for method formals, constructor formals, method return types, fields, catch formals, or any other kind of variable declaration var list = new ArrayList<String>(); var stream = list.stream();
  • 16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 – Type Inference in Java (1) More than 15 years of Type Inference in Java 16 List<Block> blocks = List.of(…); int maxWeight = blocks.stream() .filter(block -> block.getColor() == BLUE) .mapToInt(blue -> blue.getWeight()) .max();
  • 17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 – Type Inference in Java (2) Local Variable Type Inference in Java 17 var stringList = new ArrayList<String>(); var stream = new stringList.stream();
  • 18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 – Type Inference in Java (3) Local Variable Type Inference in Java 18 URL url = new URL(“http://www.oracle.com/“); URLConnection conn = url.openConnection(); Reader reader = new InputStreamReader(conn.getInputStream()); var url = new URL(“http://www.oracle.com/“); var conn = url.openConnection(); var reader = new InputStreamReader(conn.getInputStream());
  • 19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted • Reduces physical memory usage for loaded classes • Faster startup time due to pre-loaded class metadata • Shares of class metadata across JVM processes • AppCDS stores class metadata in a Java Shared Archive file (JSA) – bytecodes, field tables, method tables, etc. • JVM was modified to load more efficiently these Shared Archive files • Multiple JVM processes can memory-map the same JSA file – Memory in the JSA file is shared across processes – Memory is split into Read-Only (shared) and Read-Write (Copy-on-Write) Application Class Data Sharing – AppCDS
  • 20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Application Class Data Sharing – Overview (1) Without sharing 20
  • 21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Application Class Data Sharing – Overview (2) With sharing 21
  • 22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Application Class Data Sharing – Savings Large Web Applications 22 • Instantiates 13 JVM processes • Average footprint savings: 5-10% • Average start up savings: 10%
  • 23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 – JEP 319: Root Certificates Security-libs / java.security 23 • Provide a default set of root Certification Authority (CA) certificates for the JDK • Secure re-distribution rights for 80 Root Certificates from 17 Certificate Authorities • OpenJDK binaries can now connect to many TLS servers out-of-the-box
  • 24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JDK 10 – Project ZGC and OpenJDK EA binaries under GPL Also opened since JavaOne 2017 24 • Project ZGC – Scalable low latency garbage collector capable of handling heaps ranging from gigabytes to terabytes in size, with GC pause times not exceeding 10ms • OpenJDK Early Access binaries under GPL – Feature releases (e.g. JDK 9, JDK 10, JDK 11) – Project-specific binaries e.g. Project Valhalla
  • 25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Modularity
  • 26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Modular Development with the JDK 26
  • 27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Goals of the Java SE Module System (1) • Reliable configuration with better maintenance – replace the brittle, error-prone class-path mechanism with a means for program components to declare explicit dependences upon one another – Each modul exists once – Verification of all necessary modules exist at start time • Strong encapsulation – allow a component to declare which of its public types are accessible to other components, and which are not. Prevents access to non-public classes and API’s – module can declare an API to other modules – packages not on the API are hidden • Addressing these goals would enable further benefits: – A scalable platform for deployment of small applications and tiny runtime – Greater platform integrity and Improved performance 27
  • 28. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Non-Goals of the Java SE Module System (2) • The Java Module System does not replace OSGi • The Java Module System does not support versioning of modules 28
  • 29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | • These are the final results of the Public Review Reconsideration Ballot for JSR #376. • The EC has approved this ballot. The votes are below: 29 JSR 376: Java Module System (1) Public Review Reconsideration Ballot from 2017-06-13 to 2017-06-26 On 2017-06-13 IBM voted Yes with the following comment: IBM supports the revised JPMS specification moving to Proposed Final Draft, with credit due to Oracle as the specification leader and those in the JSR 376 Expert Group who dedicated their time to reaching this milestone.
  • 30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | • Provide a means for developers and libraries to define their own modules • Reflection API‘s for module information • Integration with developer tools (Maven, Gradle, IDE‘s) • Integration with existing package managers (e.g., RPM) • Dynamic configuration of module graph (e.g., for Java EE containers) • Documents, code, and builds Requirements The State of the Module System Initial JLS and JVMS changes API specification java.lang.Class java.lang.ClassLoader java.lang.module Issue summary 30 JSR 376: Java Module System (2) An approachable yet scalable module system for the Java Platform
  • 31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JEP 200: The Modular JDK (1) • can contain class files, resources, and related native and configuration files. • has a name. • can depend, by module name, upon one or more other modules. • can export all of the public types in one or more of the API packages that it contains, making them available to code in other modules depending on it • can restrict, by module name, the set of modules to which the public types in one or more of its API packages are exported. (sharing internal interface) • can re-export all of the public types that are exported by one or more of the modules upon which it depends. (support refactoring & aggregation) A module is a set of packages with classes & interfaces The module metadata is in module-info.class 31 Module System Assumptions: A module …
  • 32. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | JEP 200: The Modular JDK (2) • Standard modules, whose specifications are governed by the JCP, must have names starting with the string "java.". • All other modules are merely part of the JDK, and must have names starting with the string "jdk.". • If a module exports a type that contains a public or protected member that, in turn, refers to a type from some other module then the first module must re-export the public types of the second. This ensures that method-invocation chaining works in the obvious way. • Additional principles in JEP 200 text to ensure that code which depends only upon Java SE modules will depend only upon standard Java SE types. 32 Design Principles
  • 33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Modules • A module is a named, self-describing collection of code & data – Code is organized as a set of packages containing types • It declares which other modules it requires in order to be compiled and run • It declares which of its packages it exports. • Module system locates modules – Ensures code in a module can only refer to types in modules upon which it depends – The access-control mechanisms of the Java language and the Java virtual machine prevent code from accessing types in packages that are not exported by their defining modules. 33 A fundamental new kind of Java component
  • 34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Module descriptors • class files already have a precisely-defined and extensible format • consider module-info.class file as module descriptor – includes the compiled forms of source-level module declarations – may include additional kinds of information recorded in class-file attributes • inserted after the declaration is initially compiled. • An IDE can insert class file attributes containing documentary information – module version, title, description, and license. • This information can be read at compile time and run time – for use in documentation, diagnosis, and debugging 34 module-info.class advantages
  • 35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Platform modules • The only module known specifically to the module system is java.base. – The base module is always present. Every other module depends implicitly upon the base module, while the base module depends upon no other modules • The base module defines and exports all of the platform’s core packages, including the module system itself: module java.base { exports java.io; exports java.lang; exports java.lang.module; ... } 35 Modules all the way down to the base module: java.base
  • 36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Module Paths • module system can select a module to resolve a dependence – built-in to the compile-time or run-time environment or – a module defined in an artifact • the module system locates artifacts on one or more module paths defined by the host system. • A module path is a sequence of directories containing module artifacts – searched, in order, for the first artifact that defines a suitable module. • Module paths are materially different from class paths, and more robust: – A class path is a means to locate individual types in all the artifacts on the path. – A module path is a means to locate whole modules rather than individual types. • If a particular dependence can not be fulfilled then resolution will fail with an error message 36 Where do modules fulfilling dependences come from?
  • 37. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Packages and Modules - Module Declarations 37 ModuleDirective: requires {RequiresModifier} ModuleName ; exports PackageName [to ModuleName {, ModuleName}] ; opens PackageName [to ModuleName {, ModuleName}] ; uses TypeName ; provides TypeName with TypeName {, TypeName} ; Java Language Specification, Java SE 9 Edition
  • 38. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Services (1) • Our com.foo.app module extended to use a MySQL database – a MySQL JDBC driver implementing java.sql.Driver is provided in a module: module com.mysql.jdbc { requires java.sql; requires org.slf4j; exports com.mysql.jdbc; } 38 Loose coupling
  • 39. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Services (2) • In order for the java.sql module to make use of this driver we must – add the driver module to the run-time module graph – resolve its dependences • java.util.ServiceLoader class can instantiate the driver class via reflection 39 Loose coupling
  • 40. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Services (3) • Module system must be able to locate service providers. • Services provided are declared with a provides clause: module com.mysql.jdbc { requires java.sql; requires org.slf4j; exports com.mysql.jdbc; provides java.sql.Driver with com.mysql.jdbc.Driver; } 40 Loose coupling
  • 41. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Services (4) • Module system must be able to locate service users. • Services used are declared with a uses clause: module java.sql { requires public java.logging; requires public java.xml; exports java.sql; exports javax.sql; exports javax.transaction.xa; uses java.sql.Driver; } 41 Loose coupling
  • 42. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Services (5) • Clarity • Service declarations can be interpreted at compile time – to ensure that the service interface is accessible – to ensure that providers actually do implement their declared service interfaces – to ensure that observable providers are appropriately compiled and linked prior to run time • Catching runtime problems at compile time! 42 Advantages of using module declations to declare service relationships
  • 43. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Class Loaders • Few restrictions on the relationships between modules and class loaders: – A class loader can load types from one module or from many modules • as long the modules do not interfere with each other and • the types in any particular module are loaded by just one loader • Critical to compatibility – retains the existing hierarchy of built-in class loaders. • Easier to modularize existing applications with complex class loaders – class loaders can be upgraded to load types in modules – without necessarily changing their delegation patterns 43
  • 44. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Modular Class Loading in the JDK 44
  • 45. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Layers 45
  • 46. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Layer creation 46 (2) String moduleName -> { switch (moduleName) { case “java.base“: case “java.logging“: return BOOTSTRAP_LDR; default: return APP_LDR; } } (1)
  • 47. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Unnamed Modules • Every class loader has a unique unnamed module – returned by the new ClassLoader::getUnnamedModule method • A class loader loads a type not defined in a named module – that type is considered to be in the unnamed module • An unnamed module – reads every other module – exports all of its packages to every other module • Existing class-path applications using only standard APIs can keep working 47 Backwards compatibility: Loading types from the class path
  • 48. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Während der Übergangszeit bleibt diese Hintertür offen At your own risk: java launcher and javac option, as part of JEP 261: Module System 48 • --add-exports <source-module>/<package>=<target-module>(,<target-module>)* where <source-module> and <target-module> are module names and <package> is the name of a package • --add-exports java.management/com.sun.jmx.remote.internal=jmx.wbtest • --add-exports java.management/sun.management=ALL-UNNAMED The --add-exports option must be used with great care. You can use it to gain access to an internal API of a library module, or even of the JDK itself, but you do so at your own risk: If that internal API changes or is removed then your library or application will fail.
  • 49. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Java Module System and Tools • jimage • jdeps • jlink
  • 50. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 50 jimage – Modulverzeichnis-Kommando (1) C:jdk-10> java –version java 10.0.1 2018-04-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode) C:jdk-10lib> jimage info modules C:jdk-10lib> jimage list modules /* list all JDK 10 *.class files from the modules file */ C:jdk-10lib> jimage extract --dir=C:jdk-10mydir modules /* extract all JDK 10 *.class files from the libmodules file */ C:jdk-10> java --list-modules /* list the JDK 10 modules */ Tools should never read jimage files, directly or via code. It’s an JVM-internal format ..
  • 51. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 51 jimage – Modulverzeichnis-Kommando (2) • JIMAGE Format Schneller Zugriff auf die im JDK 10 enthaltene Klassen Kein langsames Durchsuchen von ZIP-Einträgen JIMAGE für beschleunigtes Klassenladen innerhalb vom JDK • JMOD Format Basiert auf dem ZIP-Format, wie das JAR-Format Für modulspezifische Metadaten und plattformspezifische Bibliotheken (DLL‘s oder SO-Files) JMOD Format soll künftig Ersatz für das JAR-Format werden, damit komplette Java-Anwendungen als Modul ausgeliefert werden können, inklusive allen Metadaten von Abhängigkeiten und exportierten API‘s Anwendungs-Rollout mit abgespeckter JRE, nur mit den benötigten Modulen Q: Without it, how can org.reflections and scannotations efficiently find all classes that have specific annotation? A: Tools should use the jrt filesystem to scan classes in the image. Details in JEP 220: http://openjdk.java.net/jeps/220 Tools should never read jimage files, directly or via code. It’s an JVM-internal format ..
  • 52. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 52 jdeps - Java-Class-Dependency-Analyzer C:mlib> jdeps -profile com.greetings.jar com.greetings [file:///C:/mlib/com.greetings.jar] requires mandated java.base (@9-ea) com.greetings -> java.base (compact1) com.greetings -> java.io compact1 com.greetings -> java.lang compact1 C:mlib> jdeps -v com.greetings.jar com.greetings [file:///C:/mlib/com.greetings.jar] requires mandated java.base (@9-ea) com.greetings -> java.base com.greetings.Main -> java.io.PrintStream java.base com.greetings.Main -> java.lang.Object java.base com.greetings.Main -> java.lang.String java.base com.greetings.Main -> java.lang.System java. base
  • 53. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | jdeps - Java-Class-Dependency-Analyzer JDK 10.0.1 (1) C:jdk-10JavaFXApplication9dist> jdeps -profile JavaFXApplication9.jar JavaFXApplication9.jar -> java.base (compact1) JavaFXApplication9.jar -> javafx.base (javafx.base) JavaFXApplication9.jar -> javafx.controls (javafx.controls) JavaFXApplication9.jar -> javafx.graphics (javafx.graphics) javafxapplication9 -> java.io compact1 javafxapplication9 -> java.lang compact1 javafxapplication9 -> javafx.application javafxapplication9 -> javafx.collections javafxapplication9 -> javafx.event javafxapplication9 -> javafx.scene javafxapplication9 -> javafx.scene.control javafxapplication9 -> javafx.scene.layout javafxapplication9 -> javafx.stage C:jdk-10JavaFXApplication3dist> jdeps -v JavaFXApplication9.jar C:jdk-10JavaFXApplication9dist> jdeps --generate-module-info C:jdk-10JavaFXApplication9dist c:jdk-10JavaFXApplication9distJavaFXApplication9.jar writing to C:jdk-10JavaFXApplication9distJavaFXApplication9module-info.java
  • 54. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | jdeps - Java-Class-Dependency-Analyzer JDK 10.0.1 (2) C:jdk-10JavaFXApplication9dist> jdeps --generate-module-info C:jdk-10JavaFXApplication9dist c:jdk-10JavaFXApplication9distJavaFXApplication9.jar writing to C:jdk-10JavaFXApplication9distJavaFXApplication9module-info.java C:jdk-10JavaFXApplication9distJavaFXApplication9> dir 18.04.2018 19:12 171 module-info.java C:jdk-10JavaFXApplication9distJavaFXApplication9> type module-info.java module JavaFXApplication9 { requires javafx.base; requires javafx.controls; requires transitive javafx.graphics; exports javafxapplication9; }
  • 55. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | jdeps - Java-Class-Dependency-Analyzer JDK 10.0.1 (3) C:jdk-10JavaFXApplication9dist> jdeps --module-path C:jdk-10JavaFXApplication9dist -s - dotoutput c:jdk-10JavaFXApplication9dist c:jdk-10JavaFXApplication9distJavaFXApplication9.jar C:jdk-10JavaFXApplication9dist> type summary.dot digraph "summary" { "JavaFXApplication9.jar" -> "java.base (java.base)"; "JavaFXApplication9.jar" -> "javafx.base (javafx.base)"; "JavaFXApplication9.jar" -> "javafx.controls (javafx.controls)"; "JavaFXApplication9.jar" -> "javafx.graphics (javafx.graphics)"; } http://www.webgraphviz.com/
  • 56. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 56 Additional diagnostic options supported by the launcher include java --show-module-resolution to show module resolution output during startup, and causes the module system to describe its activities as it constructs the initial module graph C:jdk-10> java --show-module-resolution|more root jdk.management.jfr jrt:/jdk.management.jfr root javafx.web jrt:/javafx.web root jdk.xml.dom jrt:/jdk.xml.dom root jdk.jfr jrt:/jdk.jfr root jdk.httpserver jrt:/jdk.httpserver root javafx.base jrt:/javafx.base root jdk.net jrt:/jdk.net root javafx.controls jrt:/javafx.controls root jdk.management.resource jrt:/jdk.management.resource root java.se jrt:/java.se root jdk.management.cmm jrt:/jdk.management.cmm root jdk.jsobject jrt:/jdk.jsobject root javafx.swing jrt:/javafx.swing root jdk.sctp jrt:/jdk.sctp root oracle.desktop jrt:/oracle.desktop root jdk.unsupported jrt:/jdk.unsupported root jdk.scripting.nashorn jrt:/jdk.scripting.nashorn root oracle.net jrt:/oracle.net root jdk.management jrt:/jdk.management root javafx.graphics jrt:/javafx.graphics
  • 57. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 57 jlink - generiert JRE und Applikations-Images (1) • Platzsparende Runtime, inklusive eigener Anwendungsmodule im frei wählbaren Verzeichnis jlink <options> --module-path <modulepath> --output <path> jlink --module-path $JDKMODS:mlib --add-modules myapp --output myimage C:> C:jdk-10binjlink --module-path C:jdk-10jmods;mlib --add-modules com.greetings -- compress=2 --verbose --output greetingsapplication com.greetings file:///C:/mlib/com.greetings.jar java.base file:///C:/jdk-10/jmods/java.base.jmod Providers: java.base provides java.nio.file.spi.FileSystemProvider used by java.base
  • 58. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 58 jlink - generiert JRE und Applikations-Images (2) • Image-Verzeichnis C:greetingsapplication 24,7 MB • Datei release mit früherem „build 9-ea+142-jigsaw-nightly-h5677-20161102” C:greetingsapplication> dir Directory of C:greetingsapplication 18.04.2018 15:50 <DIR> . 18.04.2018 15:50 <DIR> .. 18.04.2018 15:50 <DIR> bin 18.04.2018 15:50 <DIR> conf 18.04.2018 15:50 <DIR> include 18.04.2018 15:50 <DIR> legal 18.04.2018 15:50 <DIR> lib 18.04.2018 15:50 58 release #Thu Mar 09 22:11:23 CET 2017 OS_NAME="Windows" MODULES="java.base com.greetings" OS_VERSION="5.1" OS_ARCH="i586" JAVA_VERSION="9" JAVA_FULL_VERSION="9-ea" • Datei release „10.0.1“ JAVA_VERSION="10.0.1" MODULES="java.base com.greetings"
  • 59. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 59 jlink - generiert JRE und Applikations-Images (3) • Image-Verzeichnis C:greetingsapplication 24,7 MB C:greetingsapplicationbin> java -m com.greetings/com.greetings.Main Greetings! C:greetingsapplicationbin> dir 18.04.2018 15:50 143.360 java.dll 18.04.2018 15:50 225.280 java.exe 18.04.2018 15:50 225.280 javaw.exe 18.04.2018 15:50 19.968 jimage.dll 18.04.2018 15:50 194.560 jli.dll 18.04.2018 15:50 10.752 keytool.exe 18.04.2018 15:50 660.128 msvcp120.dll 18.04.2018 15:50 963.232 msvcr120.dll 18.04.2018 15:50 89.088 net.dll 18.04.2018 15:50 53.760 nio.dll 18.04.2018 15:50 <DIR> server 18.04.2018 15:50 43.008 verify.dll 18.04.2018 15:50 70.144 zip.dll C:mlib> java -jar com.greetings.jar Greetings!
  • 60. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 60 jlink - generiert JRE und Applikations-Images (4) • Image-Verzeichnis C:greetingsapplication 24,7 MB C:greetingsapplicationbin> java -m com.greetings/com.greetings.Main Greetings! C:greetingsapplicationbin> java --show-module-resolution -m com.greetings/com.greetings.Main root com.greetings jrt:/com.greetings Greetings! C:greetingsapplicationbin> java --list-modules -m com.greetings/com.greetings.Main com.greetings java.base@10.0.1 C:greetingsapplicationbin> java -verbose -m com.greetings/com.greetings.Main ... [1.418s][info][class,load] java.nio.charset.CoderResult$2 source: jrt:/java.base Greetings! [1.424s][info][class,load] java.lang.Shutdown source: jrt:/java.base [1.425s][info][class,load] java.lang.Shutdown$Lock source: jrt:/java.base C:greetingsapplicationbin> java --add-exports java.base/jdk.internal.ref=ALL-UNNAMED -m com.greetings/com.greetings.Main Greetings!
  • 61. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | • Sources per JDK service java .. java-8 .. java-10 org.gradle.example.service Service10 • Dependencies per JDK sources { java8 .. java10 { dependencies { library ‘org.apache.httpcomponents:httpclient:4.5.1‘ } } } 61 JSR 376: Java Module System – Gradle (1) Integration with developer tools (Maven, Gradle, IDE‘s)
  • 62. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | • JEP 238: Multi-Release JAR jar root – A.class – B.class – C.class – D.class – META-INF – versions – 8 – A.class – B.class – 9 – A.class – 10 – A.class 62 JSR 376: Java Module System – Gradle (2) Integration with developer tools (Maven, Gradle, IDE‘s) • A multi-release JAR "MRJAR" will contain additional directories for classes and resources specific to particular Java platform releases. • A JAR for a typical library might look like this: jar root – A.class – B.class – C.class – D.class
  • 63. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 63 JSR 376: Java Module System – NetBeans IDE (1) Integration with developer tools (Maven, Gradle, IDE‘s)
  • 64. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 64 JSR 376: Java Module System – NetBeans IDE (2) Integration with developer tools (Maven, Gradle, IDE‘s) http://bits.netbeans.org/download/trunk/nightly/latest/ C:Program FilesNetBeans Dev 201703140002 JDK 10.0.1 64-bit
  • 65. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Summary 65 Das Java Module System bringt viele Vorteile, aber auch größere Änderungen Existierender Anwendungs-Code, der nur offizielle Java SE Plattform-API‘s mit den unterstützten JDK-spezifischen API’s verwendet, soll auch weiterhin ohne Änderungen ablauffähig sein Abwärtskompatibilität Dennoch ist es wahrscheinlich, wenn weiterhin veraltete Funktionalität oder JDK-interne API’s verwendet werden, dass der Code unverträglich sein kann Entwickler sollten sich frühzeitig damit vertraut machen, wie existierende Bibliotheken & Anwendungen auf das aktuelle JDK anzupassen sind, wie sie modularisiert werden, welche Designfragen zu klären sind und wie man vorhandenen Anwendungs-Code trotzdem mit JDK 10 zum Laufen bekommt, auch wenn man den Code nicht verändern kann
  • 66. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Thanks! Wolfgang.Weigend@oracle.com Twitter: @wolflook 66