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
69
votes
7 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,231
  • 1
  • 19
  • 31
67
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,451
  • 7
  • 35
  • 47
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,496
  • 13
  • 26
64
votes
6 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
  • 11,415
  • 5
  • 36
  • 72
58
votes
9 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
  • 729
  • 1
  • 5
  • 6
56
votes
4 answers

What is an automatic module?

Automatic modules are mentioned many times on stackoverflow but I couldn't find a complete, succinct and self-sufficient definition of an automatic module. So, what is an automatic module? Does it export all packages? Does it open all packages? Does…
ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
55
votes
6 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,423
  • 2
  • 20
  • 47
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
  • 17,085
  • 16
  • 97
  • 197
53
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
  • 413,195
  • 112
  • 811
  • 826
52
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,226
  • 2
  • 19
  • 34
51
votes
4 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
  • 5,561
  • 3
  • 25
  • 64
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
  • 2,137
  • 20
  • 28
48
votes
2 answers

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

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
  • 5,561
  • 3
  • 25
  • 64
48
votes
3 answers

Loading classes and resources post 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
  • 12,984
  • 10
  • 64
  • 118
47
votes
5 answers

How is takeWhile different from filter?

How is takeWhile() different from filter() in Java 9. What extra utility does it have? Stream.of(1,2,3,4,5,6,7,8,9,10).filter(i -> i < 4 ) .forEach(System.out::println); This is perhaps what following would…
Rajeev Ranjan
  • 3,588
  • 6
  • 28
  • 52