4

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
  • Could you please show how you uninstaller Java 10 and how you installed Java 8? Without further details it is difficult to help you.
    – FloT
    Apr 2, 2019 at 17:29
  • Possible duplicate of Switch between multiple java versions
    – karel
    Sep 29, 2019 at 5:00

2 Answers 2

4

Make sure you are really typing:

java --version

If so, try with a single dash like:

java -version
0
  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!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .