Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Unrecognized option: --add-modules code example

Example 1: i have AdoptOpenJDK 8 but java --version gettinbg Unrecognized option: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

java -version and not java --version.

Example 2: Unrecognized option: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

java -version

Tags:

Java Example