5

I am using jdk1.8.0_25, and when I check the version of Java with the following command:

java -version

it outputs the following

java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

Please solve my problem.

galath
  • 5,717
  • 10
  • 29
  • 41
Nits
  • 1,067
  • 2
  • 9
  • 10

4 Answers4

10

I got the same error, and while the java version correctly set to 8, my JAVA_HOME env var was still set to 7.

Executing this fixed it for me:

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
snazzybucket
  • 181
  • 2
  • 8
5

Maybe you have more than one java JDK installed. Try to check that by

sudo update-alternatives --config javac 
Sebastian
  • 5,721
  • 3
  • 43
  • 69
1

Run the command />which java to determine where the java command is coming from on the path.

You either need to change to put jdk 1.8 on the path or use the fully qualified path to the java executable.

Brett Okken
  • 6,210
  • 1
  • 19
  • 25
1

You can install several different java versions on to your system. You can set the default using the update-alternatives command.

Here is a solution to a similiar problem, which is maybe of use for you: https://askubuntu.com/questions/121654/how-to-set-default-java-version

Community
  • 1
  • 1
mish
  • 1,055
  • 10
  • 29