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



Surviving Java 9

(*Sept 2017)


http://www.jclarity.com - @jclarity
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)

More Related Content

What's hot

History of java
History of javaHistory of java
History of java
Mani Sarkar
 
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_3nesrine 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
 
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
 

What's hot (20)

History of java
History of javaHistory of java
History of java
 
Play framework
Play frameworkPlay framework
Play framework
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11
 
Managed Beans: When, Why and How
Managed Beans: When, Why and HowManaged Beans: When, Why and How
Managed Beans: When, Why and How
 
Java dev mar_2021_keynote
Java dev mar_2021_keynoteJava dev mar_2021_keynote
Java dev mar_2021_keynote
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Primefaces users guide_3_3
Primefaces users guide_3_3Primefaces users guide_3_3
Primefaces users guide_3_3
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
Play! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersPlay! Framework for JavaEE Developers
Play! Framework for JavaEE Developers
 
Java platform
Java platformJava platform
Java platform
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
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
 
Implementing quality in Java projects
Implementing quality in Java projectsImplementing quality in Java projects
Implementing quality in Java projects
 
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
 
Whats New In Roller5
Whats New In Roller5Whats New In Roller5
Whats New In Roller5
 
Maven
Maven Maven
Maven
 
Java 9, JShell, and Modularity
Java 9, JShell, and ModularityJava 9, JShell, and Modularity
Java 9, JShell, and Modularity
 
Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)
 
Introduction to Apache Roller
Introduction to Apache RollerIntroduction to Apache Roller
Introduction to Apache Roller
 

Similar to The Diabolical Developer's Guide to Surviving Java 9

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) ProjectVahid 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 1Andrea 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
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
Sumit Arora
 

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)
 
Java 9 preview
Java 9 previewJava 9 preview
Java 9 preview
 
OpenDayLight (ODL) Project
OpenDayLight (ODL) ProjectOpenDayLight (ODL) Project
OpenDayLight (ODL) Project
 
JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after Modularity
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginers
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
 
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
 
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
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containers
 
Opensource gis development - part 1
Opensource gis development - part 1Opensource gis development - part 1
Opensource gis development - part 1
 
Migrating Beyond Java 8
Migrating Beyond Java 8Migrating Beyond Java 8
Migrating Beyond Java 8
 
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
 
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
 
[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1
 
Android Application WebAPI Development Training
Android Application WebAPI Development TrainingAndroid Application WebAPI Development Training
Android Application WebAPI Development Training
 
Java Programming concept
Java Programming concept Java Programming concept
Java Programming concept
 
Letest
LetestLetest
Letest
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
 

More from 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
 

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
 
Low pause GC in HotSpot
Low pause GC in HotSpotLow pause GC in HotSpot
Low pause GC in HotSpot
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final Frontier
 
Censum - Garbage Collection Log Analyser
Censum - Garbage Collection Log AnalyserCensum - Garbage Collection Log Analyser
Censum - Garbage Collection Log Analyser
 
Habits of Highly Effective Teams
Habits of Highly Effective TeamsHabits of Highly Effective Teams
Habits of Highly Effective Teams
 
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
 
The Bleeding Edge
The Bleeding EdgeThe Bleeding Edge
The Bleeding Edge
 
Raising The Bar
Raising The BarRaising The Bar
Raising The Bar
 
Hotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuideHotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning Guide
 
Hotspot Garbage Collection - The Useful Parts
Hotspot Garbage Collection - The Useful PartsHotspot Garbage Collection - The Useful Parts
Hotspot Garbage Collection - The Useful Parts
 

Recently uploaded

2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 

Recently uploaded (20)

2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 

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
  • 2.
  • 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)