Java - Mac os x - two versions

I recently updated my java version to "Java 8 update 77".

As far as i know, this is the newest version...

My Java Control Panel prints the same information,

but when i switch to terminal to verify the java version:

java -version

it outputs:

java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

When i type:

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

it prints correctly:

java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

So, did i anything wrong? Why are there two different versions listed ?

Thanks and Greetings!

Answers


Open the terminal. Type...

nano ~/.bash_profile

Search for export JAVA_HOME. When you find the line, comment it out by placing a # in front of the line.

Type on the next line...

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home

assuming that is where the jdk is. Press ctrl+o, ctrl+x.

Type source ~/.bash_profile. And you should be all set.

The second option that you have written about is where you are checking the java applet plugin version which does not need to be the same as the jdk runtime environment.


When Java is updated, it doesn't override the older version. It keeps the older version and also installs new version.

You have to change your $JAVA_HOME environment variable if you want to use new version.

This Link May help


To make your .bash_profile future proof, you can try this

export JAVA_HOME="$(/usr/libexec/java_home)"


Need Your Help

How can you prevent Man in the Browser attacks?

security browser trojan

Been reading up on MitB attacks and some things worry me about this.

Using precompiled Handlebars templates in Ember 2 project

javascript ember.js handlebars.js htmlbars

I'm need to use some precompiled handlebars templates in my ember project along with my normal components and templates. I've loaded the precompiled templates in my ember-cli-build.js file using app.