Unrecognized Option: --Version Error: Could Not Create the Java Virtual Machine. Error: a Fatal Exception Has Occurred. Program Will Exit

Unrecognized Option: --Version Error: Could Not Create the Java Virtual Machine. Error: a Fatal Exception Has Occurred. Program Will Exit

My system is ubuntu 16.04. First I had uninstalled java10 and then tried installing java8 so I am getting the below mentioned error. Please anyone can help me regarding this error with detailed steps.Please help soon its urgent.

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

2

2 Answers

Make sure you are really typing:

java --version

If so, try with a single dash like:

java -version
  1. Remove /usr/lib/jvm , this will remove jdk from your system
  2. Now again install using sudo apt install default-jdk
  3. Check command java-version, and it shows current installed version.

This worked for me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.