SlideShare a Scribd company logo
JDK-9
Modules and Java Linker (JLink)
G. Bhanu Prakash
Java Platform Team
Oracle India Private Limited
bhanu.prakash.gopularam@oracle.com
8/30/2016 1Copyright 2016, Oracle and/or it's affiliates. All rights reserved
Agenda
1. Modules
2. Module Dependencies
3. Jlink and Packaging
4. Jlink Plugins
5. Example Plugins
1. System Module Descriptor Plugin
2. Compress Plugin
3. Release-Info Plugin
8/30/2016 2
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
SAFE HARBOR STATEMENT
The following is intended to outline our general product direction. It is
intended for information purpose only, and may not be incorporated in
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
8/30/2016
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
3
Jigsaw Problems
Problems
 Platform scalability (small devices)
 Jar Hell or Classpath Hell
• Java runtime crashes with NoClassDefFoundError
• Shadowing of classes
 Performance
• Startup
• Download
8/30/2016 4
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Jigsaw Solutions
Problems
 Platform scalability
• Modularize JDK
 Jar Hell or Classpath Hell
• Replace classpath with module dependencies
 Performance
• Startup – install optimizations in module library
• Download - incremental modules in demand
8/30/2016 5
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
• What is Module
• Module-Info.java
– Visibility Rules
• REQUIRES
• EXPORTS
• REQUIRES PUBLIC
8/30/2016 6
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Modules
8/30/2016 7
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
“public” no longer means “accessible”
Modules
com.foo.app
module-info.java
module com.foo.app {
requires com.foo.bar;
requires java.sql;
}
8/30/2016 8
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Example: com.foo.app
Modules Example
com.foo.bar
module com.foo.app {
exports com.foo.bar;
}
Actual Module Dependencies (com.foo.app)
8/30/2016 9
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
8/30/2016 10
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Transitive Dependencies (com.foo.app)
JDK Platform Modules
8/30/2016 11
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
How to compile modules
Inputs
 Jmods, Modular jar files
 Exploded modules
1. Compile com.foo.bar (base)
javac -d modscom.foo.bar
srccom.foo.barmodule-info.java
srccom.foo.barcomfoobar*.java
2. Compile com.foo.app (main application)
javac -modulepath mods
-d modscom.foo.app
srccom.foo.appmodule-info.java
srccom.foo.appcomfooapp*.java
Or
javac –modulesourcepath src –d mods …
8/30/2016 12
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Create Modules
 Create module com.foo.bar
jmod create
--class-path modscom.foo.bar
com.foo.bar
 Create module com.foo.app
jmod create
--class-path modscom.foo.app
com.foo.app
8/30/2016 13
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Module Information
• jmod describe com.foo.bar
com.foo.bar
requires mandated java.base
exports com.foo.bar
• jmod describe com.foo.app
com.foo.app
requires com.foo.bar
requires mandated java.base
requires java.sql
conceals com.foo.app
8/30/2016 14
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
8/30/2016 15
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Linking
8/30/2016
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
16
Jlink and Packaging (JEP-282)
Brief History
 Jrecreate was introduced in Java 8 with EJDK (JavaSE Embedded)
 Instead of binaries we ship the EJDK
Jlink Usage: Command line tool to link module
 modules into jimage file
 generate runtime images
JEP-282: “Link time is an opportunity to do whole-world
optimizations that are otherwise difficult at compile or costly
at runtime”
8/30/2016 17
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Jlink Packaging
8/30/2016 18
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Legacy JDK image
JDK-9 Generated Image
Jlink Packaging
Create image file
jlink --output myimage
--addmods com.foo.app
--modulepath jdk-9b131jmods;mods
>ls myimage
bin lib conf release
8/30/2016
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
19
App execution from Generated image
>myimagebinjava -listmods
com.foo.app
com.foo.bar
java.base@9-ea
java.logging@9-ea
java.sql@9-ea
java.xml@9-ea
>java -m com.greetings/com.greetings.Main
Output: Greetings (com.foo.app.Main) : World (from com.foo.bar)
>java -m com.foo.app/com.foo.app.App2
Output: Exception:oracle.jdbc.driver.OracleDriver
8/30/2016 20
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
-modulepath mods
Not required
Jlink Plugins
 Image customization enabled using a set of predefined plugins
 12 builtin plugins. Example:
 compress-resources
 release-info
 sort-resources
 exclude-files
 gen-installed-modules
 replace-file
 Programmatic access to jlink features
 As per the JEP, the plugin API is strictly experimental
8/30/2016 21
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
8/30/2016 22
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Plugins and Image creation - WorkFlow
Optimizing Java startup
Problem: Significant time spent parsing and validating
module-info.class for each module in system image
itself
Solution: Implement jlink plugin to generate a pre-
validated system module graph
SystemModuleDescriptorPlugin
8/30/2016 23
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
--installed-modules Startup time
Disabled 510 ms
Enabled 220 ms
• Reduces memory use by a sizable amount
• This plugin is ON by default (--installed-modules on)
8/30/2016
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
24
Compress Plugin
LEVEL_0
StringSharingPlugin - Scans image classes constant pool (UTF-8 Strings)
LEVEL_1:
ZipPlugin(resFilter) - Zip compression of image classes
LEVEL_2:
StringSharingPlugin(resFilter)
ZipPlugin(resFilter)
8/30/2016 25
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Compression
level
Size (~)
None 28.5 MB
LEVEL_0 17.3 MB
LEVEL_1 11.7 MB
LEVEL_2 11.5 MB
Table: Jlink generated image size
Release-info Plugin
Normal JDK
myimage>cat release
#Wed Aug 24 09:19:38 IST 2016
MODULES=java.sql,com.foo.bar,com.foo.app,java.logging,java.xml,java.base
OS_VERSION=5.2
OS_ARCH=amd64
OS_NAME=Windows
JAVA_VERSION=9-ea
With Release Plugin:
jlink --release-info
add:build_type=fastdebug,source=oraclejdk,java_version=9+101 …
myimage2>cat release
#Wed Aug 24 09:32:36 IST 2016
MODULES=java.sql,com.foo.bar,com.foo.app,java.logging,java.xml,java.base
OS_VERSION=5.2
OS_ARCH=amd64
OS_NAME=Windows
JAVA_VERSION=9-ea
build_type=fastdebug,source=oraclejdk,java_version=9+101
8/30/2016 26
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Summary
• Accessibility is enforced by the compiler, VM, and Core
Reflection
• Freedom to adopt modules at your own pace
– Modularize the application
– Modularize the libraries
• Some libraries may require more changes to work as modules
8/30/2016
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
27
More Information
 OpenJDK Project Jigsaw page
 http://openjdk.java.net/project/jigsaw
 mailto: jigsaw-dev@openjdk.java.net
 Module Usage at Compile Time slides
http://openjdk.java.net/projects/jigsaw/doc/ModulesAndJavac.pdf
 Javadoc for Java Module java APIs:
http://cr.openjdk.java.net/~mr/jigsaw/api/
 Modules in the Java Language and VM
http://openjdk.java.net/projects/jigsaw/doc/lang-vm.html
8/30/2016 28
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
Thank You. Questions?
8/30/2016
Copyright 2016, Oracle and/or it's affiliates.
All rights reserved
29

More Related Content

What's hot

Java 9 preview
Java 9 previewJava 9 preview
Java 9 preview
Ivan Krylov
 
Java 9 Modularity in Action
Java 9 Modularity in ActionJava 9 Modularity in Action
Java 9 Modularity in Action
Sander Mak (@Sander_Mak)
 
Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?
Simon Ritter
 
JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?
Simon Ritter
 
Discuss about java 9 with latest features
Discuss about java 9 with latest featuresDiscuss about java 9 with latest features
Discuss about java 9 with latest features
NexSoftsys
 
Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)
Robert Scholte
 
Java 9 modularity
Java 9 modularityJava 9 modularity
Java 9 modularity
Knoldus Inc.
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
Simon Ritter
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
Simon Ritter
 
55 New Features in JDK 9
55 New Features in JDK 955 New Features in JDK 9
55 New Features in JDK 9
Simon Ritter
 
Desiging for Modularity with Java 9
Desiging for Modularity with Java 9Desiging for Modularity with Java 9
Desiging for Modularity with Java 9
Sander Mak (@Sander_Mak)
 
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Robert Scholte
 
Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9
Pavel Bucek
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep Dive
Simon Ritter
 
JDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaJDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for Java
Simon Ritter
 
Modular Java
Modular JavaModular Java
Modular Java
Martin Toshev
 
Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)
Robert Scholte
 
Migrating to Java 9 Modules
Migrating to Java 9 ModulesMigrating to Java 9 Modules
Migrating to Java 9 Modules
Sander Mak (@Sander_Mak)
 
Java SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introductionJava SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introduction
Stephen Colebourne
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changing
Simon Ritter
 

What's hot (20)

Java 9 preview
Java 9 previewJava 9 preview
Java 9 preview
 
Java 9 Modularity in Action
Java 9 Modularity in ActionJava 9 Modularity in Action
Java 9 Modularity in Action
 
Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?
 
JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?
 
Discuss about java 9 with latest features
Discuss about java 9 with latest featuresDiscuss about java 9 with latest features
Discuss about java 9 with latest features
 
Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)
 
Java 9 modularity
Java 9 modularityJava 9 modularity
Java 9 modularity
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
 
55 New Features in JDK 9
55 New Features in JDK 955 New Features in JDK 9
55 New Features in JDK 9
 
Desiging for Modularity with Java 9
Desiging for Modularity with Java 9Desiging for Modularity with Java 9
Desiging for Modularity with Java 9
 
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
 
Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep Dive
 
JDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaJDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for Java
 
Modular Java
Modular JavaModular Java
Modular Java
 
Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)
 
Migrating to Java 9 Modules
Migrating to Java 9 ModulesMigrating to Java 9 Modules
Migrating to Java 9 Modules
 
Java SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introductionJava SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introduction
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changing
 

Similar to JDK-9: Modules and Java Linker

Java 9 / Jigsaw - AJUG/VJUG session
Java 9 / Jigsaw - AJUG/VJUG  sessionJava 9 / Jigsaw - AJUG/VJUG  session
Java 9 / Jigsaw - AJUG/VJUG session
Mani Sarkar
 
Java 9: Deep Dive into Modularity and Dealing with Migration Issues
Java 9: Deep Dive into Modularity and Dealing with Migration IssuesJava 9: Deep Dive into Modularity and Dealing with Migration Issues
Java 9: Deep Dive into Modularity and Dealing with Migration Issues
GlobalLogic Ukraine
 
JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after Modularity
DanHeidinga
 
Project Jigsaw in JDK9
Project Jigsaw in JDK9Project Jigsaw in JDK9
Project Jigsaw in JDK9
Simon Ritter
 
Advanced modular development
Advanced modular development  Advanced modular development
Advanced modular development
Srinivasan Raghavan
 
Voxxed Days Thessaloniki 2016 - JDK 9 : Big Changes To Make Java Smaller
Voxxed Days Thessaloniki 2016 - JDK 9 : Big Changes To Make Java Smaller Voxxed Days Thessaloniki 2016 - JDK 9 : Big Changes To Make Java Smaller
Voxxed Days Thessaloniki 2016 - JDK 9 : Big Changes To Make Java Smaller
Patroklos Papapetrou (Pat)
 
Voxxed Days Thessaloniki 2016 - Keynote - JDK 9 : Big Changes To Make Java Sm...
Voxxed Days Thessaloniki 2016 - Keynote - JDK 9 : Big Changes To Make Java Sm...Voxxed Days Thessaloniki 2016 - Keynote - JDK 9 : Big Changes To Make Java Sm...
Voxxed Days Thessaloniki 2016 - Keynote - JDK 9 : Big Changes To Make Java Sm...
Voxxed Days Thessaloniki
 
Production Time Profiling Out of the Box
Production Time Profiling Out of the BoxProduction Time Profiling Out of the Box
Production Time Profiling Out of the Box
Marcus Hirt
 
Java9
Java9Java9
Java 9 Module System
Java 9 Module SystemJava 9 Module System
Java 9 Module System
Hasan Ünal
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
CodeOps Technologies LLP
 
Apache Maven supports all Java (JokerConf 2018)
Apache Maven supports all Java (JokerConf 2018)Apache Maven supports all Java (JokerConf 2018)
Apache Maven supports all Java (JokerConf 2018)
Robert Scholte
 
Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4Rikard Thulin
 
Jigsaw modularity
Jigsaw modularityJigsaw modularity
Jigsaw modularity
Srinivasan Raghavan
 
Preparing your code for Java 9
Preparing your code for Java 9Preparing your code for Java 9
Preparing your code for Java 9
Deepu Xavier
 
Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40
Roger Brinkley
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Martin Toshev
 
Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018
CodeOps Technologies LLP
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019
Shaun Smith
 
JDK 10 Java Module System
JDK 10 Java Module SystemJDK 10 Java Module System
JDK 10 Java Module System
Wolfgang Weigend
 

Similar to JDK-9: Modules and Java Linker (20)

Java 9 / Jigsaw - AJUG/VJUG session
Java 9 / Jigsaw - AJUG/VJUG  sessionJava 9 / Jigsaw - AJUG/VJUG  session
Java 9 / Jigsaw - AJUG/VJUG session
 
Java 9: Deep Dive into Modularity and Dealing with Migration Issues
Java 9: Deep Dive into Modularity and Dealing with Migration IssuesJava 9: Deep Dive into Modularity and Dealing with Migration Issues
Java 9: Deep Dive into Modularity and Dealing with Migration Issues
 
JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after Modularity
 
Project Jigsaw in JDK9
Project Jigsaw in JDK9Project Jigsaw in JDK9
Project Jigsaw in JDK9
 
Advanced modular development
Advanced modular development  Advanced modular development
Advanced modular development
 
Voxxed Days Thessaloniki 2016 - JDK 9 : Big Changes To Make Java Smaller
Voxxed Days Thessaloniki 2016 - JDK 9 : Big Changes To Make Java Smaller Voxxed Days Thessaloniki 2016 - JDK 9 : Big Changes To Make Java Smaller
Voxxed Days Thessaloniki 2016 - JDK 9 : Big Changes To Make Java Smaller
 
Voxxed Days Thessaloniki 2016 - Keynote - JDK 9 : Big Changes To Make Java Sm...
Voxxed Days Thessaloniki 2016 - Keynote - JDK 9 : Big Changes To Make Java Sm...Voxxed Days Thessaloniki 2016 - Keynote - JDK 9 : Big Changes To Make Java Sm...
Voxxed Days Thessaloniki 2016 - Keynote - JDK 9 : Big Changes To Make Java Sm...
 
Production Time Profiling Out of the Box
Production Time Profiling Out of the BoxProduction Time Profiling Out of the Box
Production Time Profiling Out of the Box
 
Java9
Java9Java9
Java9
 
Java 9 Module System
Java 9 Module SystemJava 9 Module System
Java 9 Module System
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
Apache Maven supports all Java (JokerConf 2018)
Apache Maven supports all Java (JokerConf 2018)Apache Maven supports all Java (JokerConf 2018)
Apache Maven supports all Java (JokerConf 2018)
 
Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4
 
Jigsaw modularity
Jigsaw modularityJigsaw modularity
Jigsaw modularity
 
Preparing your code for Java 9
Preparing your code for Java 9Preparing your code for Java 9
Preparing your code for Java 9
 
Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
 
Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019
 
JDK 10 Java Module System
JDK 10 Java Module SystemJDK 10 Java Module System
JDK 10 Java Module System
 

Recently uploaded

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

JDK-9: Modules and Java Linker

  • 1. JDK-9 Modules and Java Linker (JLink) G. Bhanu Prakash Java Platform Team Oracle India Private Limited bhanu.prakash.gopularam@oracle.com 8/30/2016 1Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 2. Agenda 1. Modules 2. Module Dependencies 3. Jlink and Packaging 4. Jlink Plugins 5. Example Plugins 1. System Module Descriptor Plugin 2. Compress Plugin 3. Release-Info Plugin 8/30/2016 2 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 3. SAFE HARBOR STATEMENT The following is intended to outline our general product direction. It is intended for information purpose only, and may not be incorporated in 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 8/30/2016 Copyright 2016, Oracle and/or it's affiliates. All rights reserved 3
  • 4. Jigsaw Problems Problems  Platform scalability (small devices)  Jar Hell or Classpath Hell • Java runtime crashes with NoClassDefFoundError • Shadowing of classes  Performance • Startup • Download 8/30/2016 4 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 5. Jigsaw Solutions Problems  Platform scalability • Modularize JDK  Jar Hell or Classpath Hell • Replace classpath with module dependencies  Performance • Startup – install optimizations in module library • Download - incremental modules in demand 8/30/2016 5 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 6. • What is Module • Module-Info.java – Visibility Rules • REQUIRES • EXPORTS • REQUIRES PUBLIC 8/30/2016 6 Copyright 2016, Oracle and/or it's affiliates. All rights reserved Modules
  • 7. 8/30/2016 7 Copyright 2016, Oracle and/or it's affiliates. All rights reserved “public” no longer means “accessible” Modules
  • 8. com.foo.app module-info.java module com.foo.app { requires com.foo.bar; requires java.sql; } 8/30/2016 8 Copyright 2016, Oracle and/or it's affiliates. All rights reserved Example: com.foo.app Modules Example com.foo.bar module com.foo.app { exports com.foo.bar; }
  • 9. Actual Module Dependencies (com.foo.app) 8/30/2016 9 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 10. 8/30/2016 10 Copyright 2016, Oracle and/or it's affiliates. All rights reserved Transitive Dependencies (com.foo.app)
  • 11. JDK Platform Modules 8/30/2016 11 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 12. How to compile modules Inputs  Jmods, Modular jar files  Exploded modules 1. Compile com.foo.bar (base) javac -d modscom.foo.bar srccom.foo.barmodule-info.java srccom.foo.barcomfoobar*.java 2. Compile com.foo.app (main application) javac -modulepath mods -d modscom.foo.app srccom.foo.appmodule-info.java srccom.foo.appcomfooapp*.java Or javac –modulesourcepath src –d mods … 8/30/2016 12 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 13. Create Modules  Create module com.foo.bar jmod create --class-path modscom.foo.bar com.foo.bar  Create module com.foo.app jmod create --class-path modscom.foo.app com.foo.app 8/30/2016 13 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 14. Module Information • jmod describe com.foo.bar com.foo.bar requires mandated java.base exports com.foo.bar • jmod describe com.foo.app com.foo.app requires com.foo.bar requires mandated java.base requires java.sql conceals com.foo.app 8/30/2016 14 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 15. 8/30/2016 15 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 16. Linking 8/30/2016 Copyright 2016, Oracle and/or it's affiliates. All rights reserved 16
  • 17. Jlink and Packaging (JEP-282) Brief History  Jrecreate was introduced in Java 8 with EJDK (JavaSE Embedded)  Instead of binaries we ship the EJDK Jlink Usage: Command line tool to link module  modules into jimage file  generate runtime images JEP-282: “Link time is an opportunity to do whole-world optimizations that are otherwise difficult at compile or costly at runtime” 8/30/2016 17 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 18. Jlink Packaging 8/30/2016 18 Copyright 2016, Oracle and/or it's affiliates. All rights reserved Legacy JDK image JDK-9 Generated Image
  • 19. Jlink Packaging Create image file jlink --output myimage --addmods com.foo.app --modulepath jdk-9b131jmods;mods >ls myimage bin lib conf release 8/30/2016 Copyright 2016, Oracle and/or it's affiliates. All rights reserved 19
  • 20. App execution from Generated image >myimagebinjava -listmods com.foo.app com.foo.bar java.base@9-ea java.logging@9-ea java.sql@9-ea java.xml@9-ea >java -m com.greetings/com.greetings.Main Output: Greetings (com.foo.app.Main) : World (from com.foo.bar) >java -m com.foo.app/com.foo.app.App2 Output: Exception:oracle.jdbc.driver.OracleDriver 8/30/2016 20 Copyright 2016, Oracle and/or it's affiliates. All rights reserved -modulepath mods Not required
  • 21. Jlink Plugins  Image customization enabled using a set of predefined plugins  12 builtin plugins. Example:  compress-resources  release-info  sort-resources  exclude-files  gen-installed-modules  replace-file  Programmatic access to jlink features  As per the JEP, the plugin API is strictly experimental 8/30/2016 21 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 22. 8/30/2016 22 Copyright 2016, Oracle and/or it's affiliates. All rights reserved Plugins and Image creation - WorkFlow
  • 23. Optimizing Java startup Problem: Significant time spent parsing and validating module-info.class for each module in system image itself Solution: Implement jlink plugin to generate a pre- validated system module graph SystemModuleDescriptorPlugin 8/30/2016 23 Copyright 2016, Oracle and/or it's affiliates. All rights reserved --installed-modules Startup time Disabled 510 ms Enabled 220 ms
  • 24. • Reduces memory use by a sizable amount • This plugin is ON by default (--installed-modules on) 8/30/2016 Copyright 2016, Oracle and/or it's affiliates. All rights reserved 24
  • 25. Compress Plugin LEVEL_0 StringSharingPlugin - Scans image classes constant pool (UTF-8 Strings) LEVEL_1: ZipPlugin(resFilter) - Zip compression of image classes LEVEL_2: StringSharingPlugin(resFilter) ZipPlugin(resFilter) 8/30/2016 25 Copyright 2016, Oracle and/or it's affiliates. All rights reserved Compression level Size (~) None 28.5 MB LEVEL_0 17.3 MB LEVEL_1 11.7 MB LEVEL_2 11.5 MB Table: Jlink generated image size
  • 26. Release-info Plugin Normal JDK myimage>cat release #Wed Aug 24 09:19:38 IST 2016 MODULES=java.sql,com.foo.bar,com.foo.app,java.logging,java.xml,java.base OS_VERSION=5.2 OS_ARCH=amd64 OS_NAME=Windows JAVA_VERSION=9-ea With Release Plugin: jlink --release-info add:build_type=fastdebug,source=oraclejdk,java_version=9+101 … myimage2>cat release #Wed Aug 24 09:32:36 IST 2016 MODULES=java.sql,com.foo.bar,com.foo.app,java.logging,java.xml,java.base OS_VERSION=5.2 OS_ARCH=amd64 OS_NAME=Windows JAVA_VERSION=9-ea build_type=fastdebug,source=oraclejdk,java_version=9+101 8/30/2016 26 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 27. Summary • Accessibility is enforced by the compiler, VM, and Core Reflection • Freedom to adopt modules at your own pace – Modularize the application – Modularize the libraries • Some libraries may require more changes to work as modules 8/30/2016 Copyright 2016, Oracle and/or it's affiliates. All rights reserved 27
  • 28. More Information  OpenJDK Project Jigsaw page  http://openjdk.java.net/project/jigsaw  mailto: jigsaw-dev@openjdk.java.net  Module Usage at Compile Time slides http://openjdk.java.net/projects/jigsaw/doc/ModulesAndJavac.pdf  Javadoc for Java Module java APIs: http://cr.openjdk.java.net/~mr/jigsaw/api/  Modules in the Java Language and VM http://openjdk.java.net/projects/jigsaw/doc/lang-vm.html 8/30/2016 28 Copyright 2016, Oracle and/or it's affiliates. All rights reserved
  • 29. Thank You. Questions? 8/30/2016 Copyright 2016, Oracle and/or it's affiliates. All rights reserved 29