SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
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)

Mais conteúdo relacionado

Mais procurados

DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DaliaAboSheasha
 
Managed Beans: When, Why and How
Managed Beans: When, Why and HowManaged Beans: When, Why and How
Managed Beans: When, Why and HowRussell Maher
 
Java dev mar_2021_keynote
Java dev mar_2021_keynoteJava dev mar_2021_keynote
Java dev mar_2021_keynoteSuyash Joshi
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11Arto Santala
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules uploadRyan 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 - ExplainedSmita Prasad
 
Play! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersPlay! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersTeng 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.xGeertjan Wielenga
 
Implementing quality in Java projects
Implementing quality in Java projectsImplementing quality in Java projects
Implementing quality in Java projectsVincent 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 2016Matt 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 RollerMatt Raible
 

Mais procurados (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
 

Semelhante a 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
 
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 ModularityDanHeidinga
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginersdivaskrgupta007
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10Arto 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 KrylovJ 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 Leejaxconf
 
OOP with Java
OOP with JavaOOP with Java
OOP with JavaOmegaHub
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projectsVincent Massol
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containersRed Hat Developers
 
Opensource gis development - part 1
Opensource gis development - part 1Opensource gis development - part 1
Opensource gis development - part 1Andrea 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 sbtFabio 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 GaelykGuillaume Laforge
 
[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1Rubens Dos Santos Filho
 
Android Application WebAPI Development Training
Android Application WebAPI Development TrainingAndroid Application WebAPI Development Training
Android Application WebAPI Development TrainingOESF 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 ControllerSumit Arora
 

Semelhante a 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
 

Mais de 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 TuningjClarity
 
Low pause GC in HotSpot
Low pause GC in HotSpotLow pause GC in HotSpot
Low pause GC in HotSpotjClarity
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final FrontierjClarity
 
Censum - Garbage Collection Log Analyser
Censum - Garbage Collection Log AnalyserCensum - Garbage Collection Log Analyser
Censum - Garbage Collection Log AnalyserjClarity
 
Habits of Highly Effective Teams
Habits of Highly Effective TeamsHabits of Highly Effective Teams
Habits of Highly Effective TeamsjClarity
 
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 LearningjClarity
 
The Bleeding Edge
The Bleeding EdgeThe Bleeding Edge
The Bleeding EdgejClarity
 
Raising The Bar
Raising The BarRaising The Bar
Raising The BarjClarity
 
Hotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuideHotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuidejClarity
 
Hotspot Garbage Collection - The Useful Parts
Hotspot Garbage Collection - The Useful PartsHotspot Garbage Collection - The Useful Parts
Hotspot Garbage Collection - The Useful PartsjClarity
 

Mais de 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
 

Último

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
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 TransformationWSO2
 

Último (20)

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
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
 

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)