Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade to Java 11: -Djava.endorsed.dirs not supported

I want to upgrade a Java 8 Spring Boot project to Java 11. It uses Gradle 4.9(wrapper). I am using Intellij 2019.1 Community version.

After downloading Java 11, when I run gradle test, I see this error:

-Djava.endorsed.dirs ..... is not supported. Endorsed standards and standalone APIs in modular form will be supported via the concept of upgradeable modules.

So, how can I solve this?

like image 987
WesternGun Avatar asked Nov 13 '19 16:11

WesternGun


People also ask

Is Java 11 still supported?

Oracle intends to support the Java LTS releases as follows: Java 7 through 2022. Java 8 through at least 2030. Java 11 through 2026.

Why there is no JRE for Java 11?

In Windows and macOS, installing the JDK in previous releases optionally installed a JRE. In JDK 11, this is no longer an option. In this release, the JRE or Server JRE is no longer offered. Only the JDK is offered.


Video Answer


1 Answers

I did these things to make it work:

  • Upgrade Intellij IDEA to 2019.2.4 Community. It seems that it is using the Java option -Djava.endorsed.dirs. Because with Gradle 5.4, I can already run the tests in terminal by gradle test. It is only the Intellij run failing.

Upgrade Gradle to 6 may not be related; with 5.4.0 it can still work.


In order for this to work in Gitlab pipeline, you have to change

  • .gitlab-ci.yml: image: openjdk:11.0.1-jdk-slim
  • Dockerfile: FROM gradle:jdk11-slim as builder

to change docker image version.

like image 200
WesternGun Avatar answered Sep 24 '22 02:09

WesternGun