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.

1606 questions
46
votes
1 answer

how to pass --add-opens JDK module configuration to maven test

I'm upgrading java version in our production code from java 8 to java 11. I have to add the below JDK module configuration in the application java start command due to usage of third party libraries like flume, zookeeper etc. --add-opens…
46
votes
7 answers

ClassNotFoundException for javax.xml.bind.JAXBException with Spring Boot when switch to Java 9

Initialized the project using start.spring.io Added WEB,JPA,H2 dependencies then tried to run the MainApplication.java using Jdk 9 and got the following error log . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( (…
Rajat
  • 2,467
  • 2
  • 29
  • 38
46
votes
1 answer

Why there is performance degradation after ~6 hours of Java 9 G1 work without the actual increase in load?

I switched 1 instance (2 vCPU, 2GB RAM, load ~4k req/sec) to Java 9 (from latest Java 8). For a while, everything was fine and CPU usage was same as before. However, after ~6 hours CPU consumption increased by 4% (from 21% to 25%) for no reason. I…
Dmitriy Dumanskiy
  • 11,657
  • 9
  • 37
  • 57
45
votes
5 answers

Java Web Start support in Java 9 and beyond

I'm confused about the status of Java Web Start. On Oracle's Support Roadmap we can read this: Support of Deployment Technology The web deployment technology, consisting of the Java Plugin and Web Start technologies, has a shorter support…
Thierry Guérin
  • 638
  • 1
  • 5
  • 8
45
votes
1 answer

Map.of() vs. Collections.emptyMap()

Is there a difference between Map.of() and Collections.emptyMap(), between List.of() and Collections.emptyList() and between Set.of() and Collections.emptySet()?
msayag
  • 8,407
  • 4
  • 30
  • 29
44
votes
2 answers

Why does Arrays.asList(...).toArray().getClass() give different results in JDK 8 and 9?

Why does the following condition return true with JDK 8, whereas it returns false with JDK 9? String[].class == Arrays.asList("a", "b").toArray().getClass()
Felix
  • 959
  • 5
  • 13
44
votes
1 answer

JEP 295 AOT: Objects compiled multiple times

I am trying to compile an application server with JDK9's new AOT feature, and am facing a number of challenges. The appserver consists of ~180 MB jars; compiling that together overflows integer so I've tried to compile each module to one (.so)…
Radim Vansa
  • 5,686
  • 2
  • 25
  • 40
44
votes
6 answers

What is the point of overloaded Convenience Factory Methods for Collections in Java 9

Java 9 comes with convenience factory methods for creating immutable lists. Finally a list creation is as simple as: List list = List.of("foo", "bar"); But there are 12 overloaded versions of this method, 11 with 0 to 10 elements, and one…
ares
  • 4,283
  • 6
  • 32
  • 63
43
votes
5 answers

Java 9 Interface vs Class

As Java 9 is going to allow us to define private and private static methods too in interfaces, what would be the remaining difference in interface and class? Moreover, is Java moving towards multiple inheritance slowly?
Aakash
  • 2,029
  • 14
  • 22
42
votes
5 answers

New Keywords in Java 9

One of Java 9's largest features will be a module system defined by Project Jigsaw. When reading slides from the Project Jigsaw: Under the Hood at JavaOne 2015, I noticed the following source code: // src/java.sql/module-info.java module java.sql { …
Will Sherwood
  • 1,484
  • 3
  • 14
  • 27
42
votes
3 answers

Private interface methods, example use-case?

"Support for private methods in interfaces was briefly in consideration for inclusion in Java SE 8 as part of the effort to add support for Lambda Expressions, but was withdrawn to enable better focus on higher priority tasks for Java SE 8. It is…
EpicPandaForce
  • 79,669
  • 27
  • 256
  • 428
41
votes
2 answers

How should I name my Java 9 module?

Suppose I have a library with groupId = org.abc and artifactId = myLibrary. What is the recommended name for the module name: myLibrary or org.abc.myLibrary? Is there any official guide for a naming scheme?
ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
40
votes
3 answers

Does Android Studio 3 support Java 9 for Android development? If so, what features of Java 9 are supported?

I'm going to install Android Studio 3 in order to develop an Android application. I'd like to know if it is possible to use Java 9 for Android development? If so, does it support all of the Java 9 features?
AhmadReza Payan
  • 2,171
  • 1
  • 23
  • 33
40
votes
3 answers

What does "Required filename-based automodules detected." warning mean?

In my multi-module project, I created module-info.java only for few modules. And during compilation with maven-compiler-plugin:3.7.0 I'm getting next warning: [WARNING] * Required filename-based automodules detected. Please don't publish this…
40
votes
3 answers

What is an open module in Java 9 and how do I use it?

What is the difference between a module with the open keyword before it and without it? For instance: open module foo { } module foo { }
user8693774
  • 403
  • 1
  • 4
  • 5