33

I am getting my new laptop going and went to install the latest oracle JDK 7u25. I followed the instructions on this site to do it.

Afterwards when I type java --version in the terminal I get the error:

Error: Could not create the Java Virtual Machine

I tried reinstalling it via a different method but the error wont go away. I am running Ubuntu 12.04 64bit.

Malte Skoruppa
  • 13,846
  • 5
  • 58
  • 65
John
  • 691

2 Answers2

115

Use:

java -version

instead of:

java --version

However, it's still not excusable that such cryptic error message is produced for the extra dash sign. Especially because java is not an amateur software but a kind of the very best software.

0
  1. System Update:

    sudo apt-get update

  2. Install Java:

    sudo apt-get install openjdk-8-jdk

  3. Verify install path:

    cd /usr/lib/jvm/java-8-openjdk-amd64

  4. We add JAVA_HOME to the environment variables in ~/.bashrc at the end of the file.

    nano ~/.bashrc

We write:

EXPORT JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

Save! (Ctrl+x)

  1. We consult the java version again:

    java --version

Output:

openjdk version "1.8.0_432"

OpenJDK Runtime Enviroment (build 1.8.0_432-8u432-ga~us1_0ubuntu2~24.04-ga)

OpenJDK 64-Bit Server VM (build 25.432-bga,mixed mode)

Congrats!

Opius
  • 1