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
55
votes
7 answers

JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState

I'm trying to run DMelt programs (http://jwork.org/dmelt/) program using Java9 (JDK9), and it gives me errors such as: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.python.core.PySystemState…
IraS
  • 699
  • 1
  • 5
  • 5
54
votes
1 answer

What's the difference between --add-exports and --add-opens in Java 9?

Java 9 (jdk-9+170) does not allow by default an application to see all classes from the JDK, unlike all previous versions of Java, due to the new module system. To workaround this, the java command line offers a new argument --add-exports which…
54
votes
6 answers

Is Maven ready for JDK9?

Today I tried the latest jdk9 Build 113 and tried to compile my project with the latest Maven 3.3.9 These are the commands (found partially via twitter) export MVN_OPTS="-Dmaven.compiler.fork…
Karussell
  • 16,303
  • 14
  • 88
  • 188
52
votes
6 answers

How to import external libraries in jshell java 9?

I was trying to understand jshell and fumbled to import external library. As of date I couldn't see any suggestion/solution for this. Can someone please let me know if already figured this out.
Akshay
  • 1,013
  • 1
  • 15
  • 27
52
votes
1 answer

What is sjavac, who is it for and how do I use it?

There has been some buzz about a tool called sjavac on the OpenJDK mailing lists. Also, there are two related JEPs: JEP 139: Enhance javac to Improve Build Speed and JEP 199: Smart Java Compilation, Phase Two. My questions are: What exactly is the…
aioobe
  • 383,660
  • 99
  • 774
  • 796
50
votes
3 answers

SimpleDateFormat with German Locale - Java 8 vs Java 10+

I have code and a test-case in a legacy application, which can be summarized as follows: @Test public void testParseDate() throws ParseException { String toParse = "Mo Aug 18 11:25:26 MESZ +0200 2014"; String pattern = "EEE MMM dd HH:mm:ss z…
rzo1
  • 4,764
  • 2
  • 21
  • 59
49
votes
4 answers

Java 9 + maven + junit: does test code need module-info.java of its own and where to put it?

Let's say I have a Java project using Maven 3 and junit. There are src/main/java and src/test/java directories which contain main sources and test sources, respectively (everything is standard). Now I want to migrate the project to Java 9.…
Roman Puchkovskiy
  • 9,798
  • 4
  • 25
  • 51
48
votes
3 answers

How do I upgrade to jlink (JDK 9+) from Java Web Start (JDK 8) for an auto-updating application?

Java 8 and prior versions have Java Web Start, which auto-updates the application when we change it. Oracle has recommended that users migrate to jlink, as that is the new Oracle technology. So far, this sounds good. This comes with a host of…
Henry Crutcher
  • 1,919
  • 17
  • 25
47
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
  • 8,478
  • 8
  • 27
  • 51
47
votes
2 answers

Project Jigsaw vs Maven

From Jigsaw Project: Make it easier for developers to construct and maintain libraries and large applications, for both the Java SE and EE Platforms. I'm trying to learn what project Jigsaw is and till now it seems that the goal of Project…
justAbit
  • 4,066
  • 1
  • 17
  • 32
45
votes
2 answers

How to safely access the URLs of all resource files in the classpath in Java 9/10?

We learned from the release notes of Java 9 that The application class loader is no longer an instance of java.net.URLClassLoader (an implementation detail that was never specified in previous releases). Code that assumes that…
rzo1
  • 4,764
  • 2
  • 21
  • 59
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
  • 628
  • 1
  • 5
  • 8
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
  • 890
  • 4
  • 11
43
votes
2 answers

Loading classes and resources in Java 9

I was reading this article on InfoQ quoting Reinhold: Developers can still use the Java class path in Java 9 for the Java runtime to search for classes and resource files. It's just that with Java 9's modules, developers no longer need the…
kaqqao
  • 10,809
  • 4
  • 50
  • 101
42
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
  • 1,875
  • 13
  • 22