SlideShare a Scribd company logo
The Diabolical Developer’s Guide To:



Surviving Java 9

(*Sept 2017)


http://www.jclarity.com - @jclarity
The Diabolical Developer's Guide to Surviving Java 9
My Background
• Martijn Verburg (@karianna)
– CEO at jClarity
– Help run Adopt a JSR & Adopt OpenJDK programs
– Java Champion, Speaker, Author, Troublemaker
– aka "The Diabolical Developer"
• Adopt OpenJDK!
– Join us at https://www.adoptopenjdk.net
What I’ll cover
1. Downloading and Installing Java 9
2. Running your App(s)
3. Compiling your App(s)
4. Major Framework / JVM Language Support
5. GC and Other Performance Impacts
6. Jigsaw and Modules….
Downloading and Installing Java 9
• The Oracle Way
– http://www.oracle.com/technetwork/java/javase/
downloads/index.html
– Mac OS X, Windows, Linux x64 (RPM or tar ball)

• The Distro Way
– apt-get and / or yum openjdk9
• The AdoptOpenJDK Way
– https://www.adoptopenjdk.net
Running your App(s)
• NOT from within your IDE
• NOT from your build tool
• DO NOT try compiling code
• DO NOT worry about modularisation
• Look for JVM warnings
JAVA_HOME / PATH etc
Set your JAVA_HOME and PATH



OR
https://github.com/shyiko/jabba
8
Example Shell Script (Mac OS X)
Your App does not need to be modularised!
Flags that will kill your JVM
• -XX:+CMSIncrementalMode
• -Xincgc
• -XX:+UseCMSCompactAtFullCollection,
• -XX:+CMSFullGCsBeforeCompaction
• -XX:+UseCMSCollectionPassing.
Flags that will give JVM Warnings
• -XX:MaxPermSize=
• -XX:PermSize=
• -XX:+UseParNewGC
• -XX:+PrintGCDetails
• -XX:+PrintGC
Removed from Java 9
• JavaDB is gone!
– Get Apache Derby from https://db.apache.org/derby/
• hprof is gone!
– This is OK, you should be using jmap, jcmd
• jhat is gone!
• jvisualvm is gone!
– Get it from http://visualvm.github.io
Runtime Access Warnings
>java -jar jython-standalone-2.7.0.jar
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by jnr.posix.JavaLibCHelper (file:/C:/Jython/jython2.7.0/jython-
standalone-2.7.0.jar) to method sun.nio.ch.SelChImpl.getFD()
WARNING: Please consider reporting this to the maintainers of jnr.posix.JavaLibCHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
Debugging Runtime Access
• —illegal-access=warn
• —illegal-access=debug
– Will give you the stacktrace
• —illegal-access=deny
– will give you future behaviour
—add-exports
• To use an internal API that has been made inaccessible
--add-exports, e.g.
--add-exports java.management/sun.management=ALL-UNNAMED
1. java.management is the source module name
2. sun.management is the package name
3. ALL-UNAMED are the target module(s)
—add-opens
• For deep reflection to access non-public members use:
—add-opens
• For example:
--add-opens java.management/sun.management=ALL-UNNAMED
Example allows all of the code on the class path to access nonpublic members
of public types in the java.management/sun.management package.
Java SE vs Java EE
• packages that are both in and out of JDK
– java.corba
– java.transaction
– java.activation
– java.xml.bind
– java.xml.ws
– java.xml.ws.annotation
• These are *not* part of the default modulepath
• These are @Deprecated for removal
– @Deprecated(since=“9”, forRemoval=true)
Java SE vs Java EE
• You can add the explicit module(s)
– —add-modules java.xml.bind
• Or deploy standalone version on the Classpath
– Just add the RI lib on your class path
• Or deploy standalone version on the module path
The move to CLDR Dates
• Unicode Common Library Date Repository
– Has subtly different behaviours if you’re not using
common locales
• Prepare for the move to 9
– java.locale.providers=JRE,CLDR
Check for library Compatibilities
https://wiki.openjdk.java.net/display/quality/Quality+Outreach
Compiling your App
• Underscores are verboten, e.g.
static Object _ = new Object();
• -source, -target and -release
– Supports a policy of 3 back
– i.e. You can’t generate Java 5 byte code
– Try to use the new -release
• Use jdeps
– Warning, its a static analysis tool only
Compile Access Warnings
error: package com.sun.java.swing.plaf.nimbus is not visible
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
^
(package com.sun.java.swing.plaf.nimbus is declared
in module java.desktop, which does not export it)
1 error
jdeps
jdeprscan
• jdeprscan commons-math3-3.6.1.jar
• This command produces several lines of output. 

For example, one line of output might be:
class org/apache/commons/math3/util/MathUtils uses
deprecated method java/lang/Double::<init>(D)V
IDEs
IDEs
• IntelliJ
– Latest version works perfectly
• Eclipse
– Latest version will work on Oct 11th
• Netbeans
– Latest development (9.0 beta) version works well
• vi
– What do you think!
IntelliJ
Netbeans 9.0 - Developer Preview
• Tools —> Java Platforms
Eclipse Oxygen.1
• In eclipse.ini after —launcher.appendVmargs add:
-vm C:Program FilesJavajdk-9binjavaw.exe
• In eclipse.ini add:
—add-modules=ALL-SYSTEM
• Then install JDT 9 support:
https://marketplace.eclipse.org/content/java-9-support-oxygen/
• Then add Java 9 via
– Preferences —> Java —> Installed JREs
Build Tools
• Maven
• Gradle
• Ant (Yes, it’s still a thing)
• Shell Script / Custom
Maven 3.5.0
• You must update all of your plugins explicitly
• https://cwiki.apache.org/confluence/display/MAVEN/Java+9+-+Jigsaw
• Plugins that still don’t work:
– Animal Sniffer
– Site (because of the version string change…)
• Does not have first class support for creating modules
Gradle 4.2
• Gradle must start on a Java 9 JDK
gradle -version
• In your build.gradle file:
sourceCompatibility = 9
targetCompatibility = 9
• Does not have first class support for
creating modules
Ant 1.10.1
Multi Release JAR files
• jar --create --file MR.jar -C sampleproject-base
demo --release 9 -C sampleproject-9 demo

- demo
- SampleClass.class
- META-INF
- versions
- 9
- demo
- SampleClass.class
• Java 9 version will override the earlier version
– If the same class name
Major Library / Framework Support
Major Development Framework Support
• Spring - Yes! ❌
• Java EE / EE4J - ❌
• RxJava - ✅
• Vert.x - ❌
Major Library Support
• Apache Commons X - Mostly ❌
• Log4J - ✅
• Hibernate - ✅
• Jackson - ✅
• JUnit and Jacoco - ✅
– JUnit 5 and Jacob 0.7.9
Major Tooling Support
• jClarity’s Censum and Illuminate - ✅
– Well very soon
• ZeroTurnaround JRebel - ✅
– Even supports module reloading
Major Web / App Server Support
• Tomcat - ❌
– 9.0.0 will fix this
• Glassfish - ❌
– 5.0.1 will fix this
• Jboss / Wildfly - ❌
– 11.0 will fix this
• Oracle’s Weblogic - ❌
• IBM’s Websphere / Liberty - ❌
GC and Other Performance Issues
• Default GC is now G1
– It’s a pause time collector
– Your app will have difference perf characteristics
– Your app will now take more memory
• New Logging
-Xlog[:[what][:[output][:[decorators][:output-options [,...]]]]]
• www.jclarity.com/censum
– See what I did there!
Compact Strings
• If all the characters of the String can be
represented using a byte — LATIN-1
– A byte array will be used internally
– Such that one byte is given for one character.
• In other cases, if any character requires
more than 8-bits to represent it
– All the characters are stored using two bytes for
each — UTF-16 representation.
Using Jigsaw / Modularity
It’s too early!!!
• The library ecosystem needs to migrate first
• The IDEs need to give better support
– IntelliJ is pretty good already
• The Build tools need to give better support
If you really have to
Some early work you can do
• Modularise your app using one of:
– Maven
– OSGi
– JBoss Modules
• Resolve split packages
• Code to interfaces
Resolving Split packages
https://github.com/AdoptOpenJDK/jsplitpkgscan
•
Goodbye Java/JVM Performance Problems
http://www.jclarity.com - @jclarity
Martijn Verburg (@karianna)
Ad

More Related Content

What's hot (20)

History of java
History of javaHistory of java
History of java
Mani Sarkar
 
Play framework
Play frameworkPlay framework
Play framework
sambaochung
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11
DaliaAboSheasha
 
Managed Beans: When, Why and How
Managed Beans: When, Why and HowManaged Beans: When, Why and How
Managed Beans: When, Why and How
Russell Maher
 
Java dev mar_2021_keynote
Java dev mar_2021_keynoteJava dev mar_2021_keynote
Java dev mar_2021_keynote
Suyash Joshi
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
Arto Santala
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
Ryan Cuprak
 
Primefaces users guide_3_3
Primefaces users guide_3_3Primefaces users guide_3_3
Primefaces users guide_3_3
nesrine attia
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
Smita Prasad
 
Play! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersPlay! Framework for JavaEE Developers
Play! Framework for JavaEE Developers
Teng Shiu Huang
 
Java platform
Java platformJava platform
Java platform
Universidade de São Paulo
 
Apache Maven
Apache MavenApache Maven
Apache Maven
Rahul Tanwani
 
What's New in NetBeans IDE 7.x
What's New in NetBeans IDE 7.xWhat's New in NetBeans IDE 7.x
What's New in NetBeans IDE 7.x
Geertjan Wielenga
 
Implementing quality in Java projects
Implementing quality in Java projectsImplementing quality in Java projects
Implementing quality in Java projects
Vincent Massol
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Matt Raible
 
Whats New In Roller5
Whats New In Roller5Whats New In Roller5
Whats New In Roller5
David M. Johnson
 
Maven
Maven Maven
Maven
Khan625
 
Java 9, JShell, and Modularity
Java 9, JShell, and ModularityJava 9, JShell, and Modularity
Java 9, JShell, and Modularity
Mohammad Hossein Rimaz
 
Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)
Trisha Gee
 
Introduction to Apache Roller
Introduction to Apache RollerIntroduction to Apache Roller
Introduction to Apache Roller
Matt Raible
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11
DaliaAboSheasha
 
Managed Beans: When, Why and How
Managed Beans: When, Why and HowManaged Beans: When, Why and How
Managed Beans: When, Why and How
Russell Maher
 
Java dev mar_2021_keynote
Java dev mar_2021_keynoteJava dev mar_2021_keynote
Java dev mar_2021_keynote
Suyash Joshi
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
Arto Santala
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
Ryan Cuprak
 
Primefaces users guide_3_3
Primefaces users guide_3_3Primefaces users guide_3_3
Primefaces users guide_3_3
nesrine attia
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
Smita Prasad
 
Play! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersPlay! Framework for JavaEE Developers
Play! Framework for JavaEE Developers
Teng Shiu Huang
 
What's New in NetBeans IDE 7.x
What's New in NetBeans IDE 7.xWhat's New in NetBeans IDE 7.x
What's New in NetBeans IDE 7.x
Geertjan Wielenga
 
Implementing quality in Java projects
Implementing quality in Java projectsImplementing quality in Java projects
Implementing quality in Java projects
Vincent Massol
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Matt Raible
 
Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)
Trisha Gee
 
Introduction to Apache Roller
Introduction to Apache RollerIntroduction to Apache Roller
Introduction to Apache Roller
Matt Raible
 

Similar to The Diabolical Developer's Guide to Surviving Java 9 (20)

Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Mihail Stoynov
 
Java 9 preview
Java 9 previewJava 9 preview
Java 9 preview
Ivan Krylov
 
OpenDayLight (ODL) Project
OpenDayLight (ODL) ProjectOpenDayLight (ODL) Project
OpenDayLight (ODL) Project
Vahid Sadri
 
JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after Modularity
DanHeidinga
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginers
divaskrgupta007
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
Arto Santala
 
What we can expect from Java 9 by Ivan Krylov
What we can expect from Java 9 by Ivan KrylovWhat we can expect from Java 9 by Ivan Krylov
What we can expect from Java 9 by Ivan Krylov
J On The Beach
 
Writing Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason LeeWriting Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason Lee
jaxconf
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
OmegaHub
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
Vincent Massol
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containers
Red Hat Developers
 
Opensource gis development - part 1
Opensource gis development - part 1Opensource gis development - part 1
Opensource gis development - part 1
Andrea Antonello
 
Migrating Beyond Java 8
Migrating Beyond Java 8Migrating Beyond Java 8
Migrating Beyond Java 8
DaliaAboSheasha
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
Fabio Fumarola
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
 
[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1
Rubens Dos Santos Filho
 
Android Application WebAPI Development Training
Android Application WebAPI Development TrainingAndroid Application WebAPI Development Training
Android Application WebAPI Development Training
OESF Education
 
Java Programming concept
Java Programming concept Java Programming concept
Java Programming concept
Prakash Poudel
 
Letest
LetestLetest
Letest
Prakash Poudel
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
Sumit Arora
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Mihail Stoynov
 
OpenDayLight (ODL) Project
OpenDayLight (ODL) ProjectOpenDayLight (ODL) Project
OpenDayLight (ODL) Project
Vahid Sadri
 
JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after Modularity
DanHeidinga
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginers
divaskrgupta007
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
Arto Santala
 
What we can expect from Java 9 by Ivan Krylov
What we can expect from Java 9 by Ivan KrylovWhat we can expect from Java 9 by Ivan Krylov
What we can expect from Java 9 by Ivan Krylov
J On The Beach
 
Writing Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason LeeWriting Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason Lee
jaxconf
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
OmegaHub
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
Vincent Massol
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containers
Red Hat Developers
 
Opensource gis development - part 1
Opensource gis development - part 1Opensource gis development - part 1
Opensource gis development - part 1
Andrea Antonello
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
Fabio Fumarola
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
 
[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1
Rubens Dos Santos Filho
 
Android Application WebAPI Development Training
Android Application WebAPI Development TrainingAndroid Application WebAPI Development Training
Android Application WebAPI Development Training
OESF Education
 
Java Programming concept
Java Programming concept Java Programming concept
Java Programming concept
Prakash Poudel
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
Sumit Arora
 
Ad

More from jClarity (10)

The Diabolical Developers Guide to Performance Tuning
The Diabolical Developers Guide to Performance TuningThe Diabolical Developers Guide to Performance Tuning
The Diabolical Developers Guide to Performance Tuning
jClarity
 
Low pause GC in HotSpot
Low pause GC in HotSpotLow pause GC in HotSpot
Low pause GC in HotSpot
jClarity
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final Frontier
jClarity
 
Censum - Garbage Collection Log Analyser
Censum - Garbage Collection Log AnalyserCensum - Garbage Collection Log Analyser
Censum - Garbage Collection Log Analyser
jClarity
 
Habits of Highly Effective Teams
Habits of Highly Effective TeamsHabits of Highly Effective Teams
Habits of Highly Effective Teams
jClarity
 
Illuminate - Performance Analystics driven by Machine Learning
Illuminate - Performance Analystics driven by Machine LearningIlluminate - Performance Analystics driven by Machine Learning
Illuminate - Performance Analystics driven by Machine Learning
jClarity
 
The Bleeding Edge
The Bleeding EdgeThe Bleeding Edge
The Bleeding Edge
jClarity
 
Raising The Bar
Raising The BarRaising The Bar
Raising The Bar
jClarity
 
Hotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuideHotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning Guide
jClarity
 
Hotspot Garbage Collection - The Useful Parts
Hotspot Garbage Collection - The Useful PartsHotspot Garbage Collection - The Useful Parts
Hotspot Garbage Collection - The Useful Parts
jClarity
 
The Diabolical Developers Guide to Performance Tuning
The Diabolical Developers Guide to Performance TuningThe Diabolical Developers Guide to Performance Tuning
The Diabolical Developers Guide to Performance Tuning
jClarity
 
Low pause GC in HotSpot
Low pause GC in HotSpotLow pause GC in HotSpot
Low pause GC in HotSpot
jClarity
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final Frontier
jClarity
 
Censum - Garbage Collection Log Analyser
Censum - Garbage Collection Log AnalyserCensum - Garbage Collection Log Analyser
Censum - Garbage Collection Log Analyser
jClarity
 
Habits of Highly Effective Teams
Habits of Highly Effective TeamsHabits of Highly Effective Teams
Habits of Highly Effective Teams
jClarity
 
Illuminate - Performance Analystics driven by Machine Learning
Illuminate - Performance Analystics driven by Machine LearningIlluminate - Performance Analystics driven by Machine Learning
Illuminate - Performance Analystics driven by Machine Learning
jClarity
 
The Bleeding Edge
The Bleeding EdgeThe Bleeding Edge
The Bleeding Edge
jClarity
 
Raising The Bar
Raising The BarRaising The Bar
Raising The Bar
jClarity
 
Hotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuideHotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning Guide
jClarity
 
Hotspot Garbage Collection - The Useful Parts
Hotspot Garbage Collection - The Useful PartsHotspot Garbage Collection - The Useful Parts
Hotspot Garbage Collection - The Useful Parts
jClarity
 
Ad

Recently uploaded (20)

Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 

The Diabolical Developer's Guide to Surviving Java 9

  • 1. The Diabolical Developer’s Guide To:
 
 Surviving Java 9
 (*Sept 2017) 
 http://www.jclarity.com - @jclarity
  • 3. My Background • Martijn Verburg (@karianna) – CEO at jClarity – Help run Adopt a JSR & Adopt OpenJDK programs – Java Champion, Speaker, Author, Troublemaker – aka "The Diabolical Developer" • Adopt OpenJDK! – Join us at https://www.adoptopenjdk.net
  • 4. What I’ll cover 1. Downloading and Installing Java 9 2. Running your App(s) 3. Compiling your App(s) 4. Major Framework / JVM Language Support 5. GC and Other Performance Impacts 6. Jigsaw and Modules….
  • 5. Downloading and Installing Java 9 • The Oracle Way – http://www.oracle.com/technetwork/java/javase/ downloads/index.html – Mac OS X, Windows, Linux x64 (RPM or tar ball)
 • The Distro Way – apt-get and / or yum openjdk9 • The AdoptOpenJDK Way – https://www.adoptopenjdk.net
  • 6. Running your App(s) • NOT from within your IDE • NOT from your build tool • DO NOT try compiling code • DO NOT worry about modularisation • Look for JVM warnings
  • 8. Set your JAVA_HOME and PATH
 
 OR https://github.com/shyiko/jabba 8
  • 9. Example Shell Script (Mac OS X)
  • 10. Your App does not need to be modularised!
  • 11. Flags that will kill your JVM • -XX:+CMSIncrementalMode • -Xincgc • -XX:+UseCMSCompactAtFullCollection, • -XX:+CMSFullGCsBeforeCompaction • -XX:+UseCMSCollectionPassing.
  • 12. Flags that will give JVM Warnings • -XX:MaxPermSize= • -XX:PermSize= • -XX:+UseParNewGC • -XX:+PrintGCDetails • -XX:+PrintGC
  • 13. Removed from Java 9 • JavaDB is gone! – Get Apache Derby from https://db.apache.org/derby/ • hprof is gone! – This is OK, you should be using jmap, jcmd • jhat is gone! • jvisualvm is gone! – Get it from http://visualvm.github.io
  • 14. Runtime Access Warnings >java -jar jython-standalone-2.7.0.jar WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by jnr.posix.JavaLibCHelper (file:/C:/Jython/jython2.7.0/jython- standalone-2.7.0.jar) to method sun.nio.ch.SelChImpl.getFD() WARNING: Please consider reporting this to the maintainers of jnr.posix.JavaLibCHelper WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
  • 15. Debugging Runtime Access • —illegal-access=warn • —illegal-access=debug – Will give you the stacktrace • —illegal-access=deny – will give you future behaviour
  • 16. —add-exports • To use an internal API that has been made inaccessible --add-exports, e.g. --add-exports java.management/sun.management=ALL-UNNAMED 1. java.management is the source module name 2. sun.management is the package name 3. ALL-UNAMED are the target module(s)
  • 17. —add-opens • For deep reflection to access non-public members use: —add-opens • For example: --add-opens java.management/sun.management=ALL-UNNAMED Example allows all of the code on the class path to access nonpublic members of public types in the java.management/sun.management package.
  • 18. Java SE vs Java EE • packages that are both in and out of JDK – java.corba – java.transaction – java.activation – java.xml.bind – java.xml.ws – java.xml.ws.annotation • These are *not* part of the default modulepath • These are @Deprecated for removal – @Deprecated(since=“9”, forRemoval=true)
  • 19. Java SE vs Java EE • You can add the explicit module(s) – —add-modules java.xml.bind • Or deploy standalone version on the Classpath – Just add the RI lib on your class path • Or deploy standalone version on the module path
  • 20. The move to CLDR Dates • Unicode Common Library Date Repository – Has subtly different behaviours if you’re not using common locales • Prepare for the move to 9 – java.locale.providers=JRE,CLDR
  • 21. Check for library Compatibilities https://wiki.openjdk.java.net/display/quality/Quality+Outreach
  • 22. Compiling your App • Underscores are verboten, e.g. static Object _ = new Object(); • -source, -target and -release – Supports a policy of 3 back – i.e. You can’t generate Java 5 byte code – Try to use the new -release • Use jdeps – Warning, its a static analysis tool only
  • 23. Compile Access Warnings error: package com.sun.java.swing.plaf.nimbus is not visible import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel; ^ (package com.sun.java.swing.plaf.nimbus is declared in module java.desktop, which does not export it) 1 error
  • 24. jdeps
  • 25. jdeprscan • jdeprscan commons-math3-3.6.1.jar • This command produces several lines of output. 
 For example, one line of output might be: class org/apache/commons/math3/util/MathUtils uses deprecated method java/lang/Double::<init>(D)V
  • 26. IDEs
  • 27. IDEs • IntelliJ – Latest version works perfectly • Eclipse – Latest version will work on Oct 11th • Netbeans – Latest development (9.0 beta) version works well • vi – What do you think!
  • 29. Netbeans 9.0 - Developer Preview • Tools —> Java Platforms
  • 30. Eclipse Oxygen.1 • In eclipse.ini after —launcher.appendVmargs add: -vm C:Program FilesJavajdk-9binjavaw.exe • In eclipse.ini add: —add-modules=ALL-SYSTEM • Then install JDT 9 support: https://marketplace.eclipse.org/content/java-9-support-oxygen/ • Then add Java 9 via – Preferences —> Java —> Installed JREs
  • 31. Build Tools • Maven • Gradle • Ant (Yes, it’s still a thing) • Shell Script / Custom
  • 32. Maven 3.5.0 • You must update all of your plugins explicitly • https://cwiki.apache.org/confluence/display/MAVEN/Java+9+-+Jigsaw • Plugins that still don’t work: – Animal Sniffer – Site (because of the version string change…) • Does not have first class support for creating modules
  • 33. Gradle 4.2 • Gradle must start on a Java 9 JDK gradle -version • In your build.gradle file: sourceCompatibility = 9 targetCompatibility = 9 • Does not have first class support for creating modules
  • 35. Multi Release JAR files • jar --create --file MR.jar -C sampleproject-base demo --release 9 -C sampleproject-9 demo - demo - SampleClass.class - META-INF - versions - 9 - demo - SampleClass.class • Java 9 version will override the earlier version – If the same class name
  • 36. Major Library / Framework Support
  • 37. Major Development Framework Support • Spring - Yes! ❌ • Java EE / EE4J - ❌ • RxJava - ✅ • Vert.x - ❌
  • 38. Major Library Support • Apache Commons X - Mostly ❌ • Log4J - ✅ • Hibernate - ✅ • Jackson - ✅ • JUnit and Jacoco - ✅ – JUnit 5 and Jacob 0.7.9
  • 39. Major Tooling Support • jClarity’s Censum and Illuminate - ✅ – Well very soon • ZeroTurnaround JRebel - ✅ – Even supports module reloading
  • 40. Major Web / App Server Support • Tomcat - ❌ – 9.0.0 will fix this • Glassfish - ❌ – 5.0.1 will fix this • Jboss / Wildfly - ❌ – 11.0 will fix this • Oracle’s Weblogic - ❌ • IBM’s Websphere / Liberty - ❌
  • 41. GC and Other Performance Issues • Default GC is now G1 – It’s a pause time collector – Your app will have difference perf characteristics – Your app will now take more memory • New Logging -Xlog[:[what][:[output][:[decorators][:output-options [,...]]]]] • www.jclarity.com/censum – See what I did there!
  • 42. Compact Strings • If all the characters of the String can be represented using a byte — LATIN-1 – A byte array will be used internally – Such that one byte is given for one character. • In other cases, if any character requires more than 8-bits to represent it – All the characters are stored using two bytes for each — UTF-16 representation.
  • 43. Using Jigsaw / Modularity
  • 44. It’s too early!!! • The library ecosystem needs to migrate first • The IDEs need to give better support – IntelliJ is pretty good already • The Build tools need to give better support
  • 45. If you really have to
  • 46. Some early work you can do • Modularise your app using one of: – Maven – OSGi – JBoss Modules • Resolve split packages • Code to interfaces
  • 48.
  • 49. Goodbye Java/JVM Performance Problems http://www.jclarity.com - @jclarity Martijn Verburg (@karianna)