Questions tagged [java-9]

Use this tag for questions specific to Java 9, which is version 9 of the Java platform, released on the 21st of September 2017. In most cases you should also specify the java tag.

Oracle has released its updated list of proposed or targeted Java 9 enhancements. In addition to previously confirmed Java modularity updates, the most recent list includes a common logging system for all JVM components (JEP 158), more HotSpot JIT compiler controls (JEP 158), and refinements to improve the efficiency of garbage collection (JEP 214), and repair issues introduced by Project Coin language updates in JDK 7 (JEP 213). This is also the first release under the new version-string schema (JEP 223) and will hence be officially be numbered 9, not "1.9.0" as was the case for earlier versions.

Even with delays, Oracle has been steadily moving forward with its plans to modularize the JDK. But the scope of Java modularity took a step up in September, when Oracle announced four new JEPs, including JEP 220: Modular Run-Time Images. Ben Evans, writing for InfoQ, noted that swapping JARs for modules is the "point of no return for modularity," with serious implications for IDEs, toolmakers, and many Java application frameworks:

After this point, The Java Runtime Environment (JRE) will no longer be contained in jar files, and instead will be composed of modules (JSR 376). Files such as rt.jar and tools.jar no longer exist in the JRE. The platform will continue to accept and run applications and libraries packaged in conventional jar files, modular jar files, or in the new module file format. The intention is that over time, application developers wil migrate to the new modular formats as well.

See "Oracle Commit to Java Modularity" for more from Ben Evans on modularity updates in Java 9. Also see Takipi Blog: "Java 9 – The Ultimate Feature List" for a comprehensive (as of November 20, 2014) description of new features accepted or proposed for the next major release of Java, and "What's New in Java 9? (Besides Modules)" for another more recent compilation of features.

The API documentation of the release can be accessed at Oracle's technetwork.

1561 questions
80
votes
10 answers

How to hide warning "Illegal reflective access" in java 9 without JVM argument?

I just tried to run my server with Java 9 and got next warning: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil…
Dmitriy Dumanskiy
  • 8,478
  • 8
  • 27
  • 51
80
votes
5 answers

Why project Jigsaw / JPMS?

Java's package management system always seemed simple and effective to me. It is heavily used by the JDK itself. We have been using it to mimic the concept of namespaces and modules. What is Project Jigsaw (aka Java Platform Module System) trying to…
John
  • 9,897
  • 20
  • 63
  • 107
78
votes
2 answers

Why does \R behave differently in regular expressions between Java 8 and Java 9?

The following code compiles in both Java 8 & 9, but behaves differently. class Simple { static String sample = "\nEn un lugar\r\nde la Mancha\nde cuyo nombre\r\nno quiero acordarme"; public static void main(String args[]){ String[]…
Germán Bouzas
  • 1,350
  • 1
  • 12
  • 17
77
votes
6 answers

What's the difference between requires and requires transitive statements in Java 9?

What's the difference between requires and requires transitive module statements in module declaration? For example: module foo { requires java.base; requires transitive java.compiler; }
Michał Szewczyk
  • 5,656
  • 7
  • 28
  • 41
75
votes
4 answers

takeWhile() working differently with flatmap

I am creating snippets with takeWhile to explore its possibilities. When used in conjunction with flatMap, the behaviour is not in line with the expectation. Please find the code snippet below. String[][] strArray = {{"Sample1", "Sample2"},…
Jeevan Varughese
  • 1,811
  • 1
  • 13
  • 20
74
votes
2 answers

Stream.peek() method in Java 8 vs Java 9

I am in the progress of learning through Java 8 lambda expressions and would like to ask about the following piece of Java code relating to the peek method in the function interface that I have come across. On execution of the program on IDE, it…
Patrick C.
  • 1,019
  • 8
  • 18
71
votes
4 answers

Difference between RxJava API and the Java 9 Flow API

It seems on every iteration of Java for the last few major releases, there are consistently new ways to manage concurrent tasks. In Java 9, we have the Flow API which resembles the Flowable API of RxJava but with Java 9 has a much simpler set of…
Dovmo
  • 6,676
  • 2
  • 19
  • 38
68
votes
6 answers

What is the replacement for javax.activation package in java 9?

Seems like javax.activation package is deprecated in Java 9. Oracle migration guide proposes to use --add-modules java.activation option during JVM start. However, I would like to avoid this and replace javax.activation package's classes, as it is…
Dmitriy Dumanskiy
  • 8,478
  • 8
  • 27
  • 51
67
votes
6 answers

Maven compilation issue with Java 9

Trying to compile a Maven project using JDK 9.0.1 I'm facing this stacktrace without much of an explanation: Exception in thread "main" java.lang.AssertionError at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155) at…
Peter Major
  • 2,565
  • 2
  • 14
  • 16
66
votes
4 answers

Difference between compact strings and compressed strings in Java 9

What are the advantages of compact strings over compressed strings in JDK9?
soorapadman
  • 4,123
  • 6
  • 31
  • 42
64
votes
1 answer

Why does String.replaceAll() work differently in Java 8 from Java 9?

Why does this code output 02 in java-8 but o2 in java-9 or above? "o2".replaceAll("([oO])([^[0-9-]])", "0$2")
Fuyang Liu
  • 1,396
  • 9
  • 24
62
votes
2 answers

Why did Java 9 introduce the JMOD file format?

Java 9 has three ways to package compiled code in files: JAR JMOD JIMAGE JIMAGE is optimized for speed and space and used by the JVM at runtime so it makes sense why JIMAGE was introduced. JIMAGE files are not supposed to be published to maven…
ams
  • 52,592
  • 57
  • 169
  • 252
56
votes
7 answers

Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1

My JDK 9+181 Spring Boot 2.0.0.BUILD-SNAPSHOT CLI application displays this warning on startup: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1…
Jan Nielsen
  • 8,956
  • 12
  • 56
  • 105
55
votes
2 answers

Cannot be cast to class because they are in unnamed module of loader 'app'

I'm trying to create a bean from sources that were generated by wsdl2java. Every time I try to run my Spring Boot app, I get the following error: Caused by: java.lang.ClassCastException: class org.apache.cxf.endpoint.ClientImpl cannot be cast to…
Francisco Mateo
  • 13,336
  • 4
  • 31
  • 49
55
votes
5 answers

Can Java 9 run on a 32-bit OS?

Seems there are no 32-bit download packages on Oracle's available download list. UPDATE Can download here: wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"…
auntyellow
  • 2,075
  • 2
  • 13
  • 35