0

I tried updating to the latest version of JRE and I checked my Java Control Panel and it says I have the latest version. But when I go on my terminal and checked by typing

java -version

I'm getting

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)

However, when I checked the version by typing

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version

I did get the correct version:

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)

What can I do to make sure I am running version 1.8? I need it to run elasticsearch and I've been pulling my hair out over the right version of java on my machine (Mac).

Kaisin Li
  • 514
  • 3
  • 7
  • 21
  • If you are using window, check your path settings. It may still pointing to 1.6. Also check java_home making sure it is pointing to the latest version – Jules Sep 04 '18 at 01:27
  • @Jules I'm on Mac – Kaisin Li Sep 04 '18 at 01:29
  • Check this article. https://stackoverflow.com/questions/21964709/how-to-set-or-change-the-default-java-jdk-version-on-os-x – Jules Sep 04 '18 at 01:30
  • @Jules Ah I see. But when I ran /usr/libexec/java_home -V the 1.8 version isn't showing up as a Matching Java Virtual Machine. Any idea why? – Kaisin Li Sep 04 '18 at 01:43
  • Sorry, Can't help you with a specific question as I am a window user :) – Jules Sep 04 '18 at 01:49

4 Answers4

0

you can try to run this code System.out.println(System.getProperty("java.version"));

xzg
  • 181
  • 1
  • 2
  • 8
0
  1. Go to Control Panel\All Control Panel Items\System.
  2. Click on Advance System Settings
  3. Under Advance Tab, click on "Environmental Variables"
  4. Under System Variable section check "path".

check under path what is set for java.

Sayantan Mandal
  • 1,246
  • 14
  • 20
0

Check your environment variable path, it would be pointing to the earlier version Update that path and again check. It should work

Dipesh Desai
  • 104
  • 1
  • 12
  • when I ran /usr/libexec/java_home -V the 1.8 version isn't showing up as a Matching Java Virtual Machine. Any idea why? I do see two versions of 1.6 listed but not the 1.8 – Kaisin Li Sep 04 '18 at 01:51
  • is there a way you can uninstall the earlier version? I am a windows user, so I am not sure if it's possible in mac – Dipesh Desai Sep 04 '18 at 02:27
0

It looks like I need to download the entire Java Development Kit

Kaisin Li
  • 514
  • 3
  • 7
  • 21