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

Student_AG
  • 41
  • 1
  • 1
  • 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 02 '19 at 17:29
  • Possible duplicate of [Switch between multiple java versions](https://askubuntu.com/questions/740757/switch-between-multiple-java-versions) – karel Sep 29 '19 at 05:00

2 Answers2

4

Make sure you are really typing:

java --version

If so, try with a single dash like:

java -version
double-beep
  • 195
  • 1
  • 4
  • 12
pete
  • 171
  • 1
  • 9
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!

andrew.46
  • 37,085
  • 25
  • 149
  • 228