Unrecognized option: --add-exports java.base/sun.nio.ch=ALL-UNNAMED from Docker container

186 Views Asked by At

I would appreciate your assistance in resolving the issue I have encountered

While addressing Apache Spark 3.3.0 breaks on Java 17 with "cannot access class sun.nio.ch.DirectBuffer" problem I have attempted to implement the suggested solution, which functions successfully when running my code from IntelliJ.

However, I need to execute my final code within a Docker image. I have approached this by specifying the necessary VM options in a straightforward manner. Here is an example of how I have specified the required options:

ENTRYPOINT ["java","--add-exports java.base/sun.nio.ch=ALL-UNNAMED" ...  

I have tried various options and I am confident that they are all correct. Unfortunately, regardless of the options I choose, I consistently encounter the following result:

Unrecognized option: --add-exports java.base/sun.nio.ch=ALL-UNNAMED  

I experimented with various images, without a big success.

All image are running with the same JAVA version I tried on my MAC+IntelliJ

openjdk version "17.0.7" 2023-04-18 LTS
OpenJDK Runtime Environment Corretto-17.0.7.7.1 (build 17.0.7+7-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.7.7.1 (build 17.0.7+7-LTS, mixed mode, sharing)

Thank you in advance for your help.

0

There are 0 best solutions below