Questions tagged [java-14]

Reference Implementation of version 14 of the Java SE Platform, as specified by JSR 389 in the Java Community Process. Use this tag for questions specific to Java 14, which is version 14 of the Java platform, released on 17 March 2020. In most cases you should also specify the java tag.

Version 14 of the Java programming language.

The reference implementation of Java 14 reached General Availability on 17 March 2020.

The JDK/14 production-ready binaries for Linux and Windows.

New features and improvements:

  • Pattern Matching for instanceof (Preview)
  • Packaging Tool (Incubator)
  • NUMA-Aware Memory Allocation for G1
  • JFR Event Streaming
  • Non-Volatile Mapped Byte Buffers
  • Helpful NullPointerExceptions
  • Records (Preview)
  • Switch Expressions (Standard)
  • Deprecate the Solaris and SPARC Ports
  • Remove the Concurrent Mark Sweep (CMS) Garbage Collector
  • ZGC on macOS
  • ZGC on Windows
  • Deprecate the ParallelScavenge + SerialOld GC Combination
  • Remove the Pack200 Tools and API
  • Text Blocks (Second Preview)
  • Foreign-Memory Access API (Incubator)

Specified by JSR 389 in the Java Community Process.

192 questions
10
votes
1 answer

Couldn't install netbeans 11.3 with Java 14 due to Error: "Unsupported JVM version"

I'm trying to install netbeans with Java 14. I'm getting below error - > sudo ./Apache-NetBeans-11.3-bin-linux-x64.sh --javahome /home/raj/.sdkman/candidates/java/current Configuring the installer... Searching for JVM on the system... Unsupported…
user51
  • 8,843
  • 21
  • 79
  • 158
9
votes
1 answer

In Java how do you debug exe created by JPackage

I am trying to convert an Windows installation of Java app created with Izpack to use JPackage provided In Java 14. The installer builds and installs, but when I try and run the exe it creates it fails, but gives no information about why it…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
9
votes
4 answers

Records in jlink:ed application throws exception

Using records (preview feature java-14) in a jlink:ed application, gives below error when using options: options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] java.lang.ClassFormatError: Invalid constant pool index…
Aksel Willgert
  • 11,367
  • 5
  • 53
  • 74
9
votes
1 answer

PMD plugin fails with Java 14: Unsupported targetJdk

I am trying to have a pom.xml file with PMD plugin integrated into build stage. PMD version 3.13.0 Oracle JDK 14
Yan Khonski
  • 12,225
  • 15
  • 76
  • 114
9
votes
0 answers

Java 14 Syntax error on token "record", record expected

I'm engaged in building something in Java 14. I wrote a class named for PersonInJava14 shown below. package recordexample; public record PersonInJava14(String name, String gender, int age) {} However, it throws an error like this. Syntax error on…
S.N
  • 2,157
  • 3
  • 29
  • 78
9
votes
1 answer

When using Oracle JDK 14 all gradle (6.2.2) tasks fail with "Could not initialize class org.codehaus.groovy.runtime.InvokerHelper"

I installed JDK 14 and started using it. However projects that use Gradle 6.2.2 cannot work, and the following error appears each time I try to invoke a Gradle Task : Could not initialize class org.codehaus.groovy.runtime.InvokerHelper Other…
Spyros K
  • 2,480
  • 1
  • 20
  • 37
9
votes
0 answers

Is it safe to grant untrusted code "suppressAccessChecks" when -illegal-access=deny is set?

Without illegal access (--illegal-access=deny) and denying access to jdk.unsupported (done using accessClassInPackage checks), it looks like the ReflectPermission "suppressAccessChecks" would not any longer lead to a full sandbox escape. Is that…
Johannes Kuhn
  • 14,778
  • 4
  • 49
  • 73
8
votes
1 answer

Do Java records support "with" syntax?

Java 14 brings records, which are a great addition seen in many functional languages: Java: public record Vehicle(String brand, String licensePlate) {} ML: type Vehicle = { Brand : string LicensePlate : string } In ML languages, it is…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
8
votes
1 answer

JDEPS Module Not Found Exception when listing dependancies

I have been working with JLink to create minimal JRE for various Spring Boot applications. I have successfully done this manually by figuring out the required Modules via trial and error. After successfully doing this I have been attempting to…
8
votes
1 answer

Java Records and Lombok annotation - IntelliJ

Just trying a hands-on the java.lang.Record. I have gone through the documentation and the JEP-359 for some understanding. So upon reading about the implicit declaration of the constructor I thought of mixing it up with an existing code generation…
Naman
  • 27,789
  • 26
  • 218
  • 353
7
votes
1 answer

Java records validation anotation

I have old POJO with valid annotation: public class SomeData { @NotNull(message = "Data not be null") private String data; public FormData(String data) { this.data = data; } public String getData() { return…
Valdy B
  • 151
  • 1
  • 1
  • 9
7
votes
0 answers

How to setup sbt to use java 14 preview features

I have an sbt project with both Scala (2.13.1) and Java files. I'd like to compile the java files using Java 14, including the preview features. How can I do that? Following oracle's docs above, I tried to set the javaOptions +…
dvir
  • 2,546
  • 2
  • 18
  • 15
7
votes
2 answers

Pattern matching instanceof

I came across this amazing topic on https://www.baeldung.com/java-pattern-matching-instanceof. But when I try to run the following code, it throws compile time error: if(obj instanceof String s) { System.out.println(s); } The error…
user13120093
7
votes
1 answer

How to enable helpful NullPointerExceptions in gradle test

This problem has been fixed in Gradle 6.6 Original post I want to put the flag -XX:+ShowCodeDetailsInExceptionMessages to enable helpful NPEs (https://openjdk.java.net/jeps/358) on the tests I tried tasks.withType { …
apflieger
  • 912
  • 10
  • 18
7
votes
1 answer

running JavaFX application after jpackage

I have some really noob question. I tried to create installation for my test app with jpackage in OpenJDK 14. Here is what I did: first, created custom JRE with jlink --module-path "C:\Java\javafx-sdk-14\lib" --add-modules…
1 2
3
12 13