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!
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
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.
To make your .bash_profile future proof, you can try this
export JAVA_HOME="$(/usr/libexec/java_home)"
Related
I am trying to migrate a tomcat server.
Both are using tomcat7 version and all is supossed to be ready to take my java/jsp files from one server to another.
I did and I got UnsupportedClassVersionError error.
It was normal as in the old one I had JRE 1.8 version and in the new installation I had JRE 1.7 version (both from Oracle).
I proceeded to upgrade the second to 1.8. And everything was fine as in the new the output for java -version is:
java version "1.8.0_191" Java(TM) SE Runtime Environment (build
1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
While in the old one:
java version "1.8.0_131" Java(TM) SE Runtime Environment (build
1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
In both echo $JAVA_HOME outputs:
/usr/lib/jvm/java-8-oracle
I restarted tomcat and server itself... but the UnsupportedClassVersionError persists.
I don't know if:
Somewhere I still point to the JRE 1.7 installation
Or 1.8.0_191 is considered another version than 1.8.0_131
Note: the compiler is the same as they have not been recompiled. Just take the compiled ones from old server (where there is no problem version) to the new one.
Has anyone a hint for me?
Thank you very much
As pointed in comments, sometimes JAVA_HOME is not checked and the decision on what jvm should be used is taken with another criteria (can't say which ones). So removing the old version of java forced the process to choose the desired one as it was unique.
I use macOS Sierra. When I do:
java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
it seems that my java version is 1.6.0.
But when I look at System Preferences I find that my version is Java 8 Update 144. I want to use an R package that needs Java >=8.0. What have I done wrong?
The Java found in your command line is the one used to compile when using command line, first, try export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) then check if the correct version shows up using java -version if not reinstall the newest java and run the command again
I am aware this might look duplicated, but I don't seem to find the answer that I am seeking (perhaps is too trivial).
I just downloaded java from the oracle site and I read this:
$java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Then I added this to my .bash_profile file:
# Java
export JAVA_HOME="`/usr/libexec/java_home -v 1.8`"
so that:
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
So far so good.
Now when I type:
$ which java
/usr/bin/Java
Which I think is the default installation (?, I really have no experience in Java)
At this stage, I don't know if I have to simlink:
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java /usr/bin
or if the simlink was establish during the java installation. I am going to start installing a series of things that depend on java, so I would like to make sure I understand this before moving on.
Thanks!
What you've done will work. From my system:
$ /usr/bin/java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
It uses the java_home command you used, which depends on the Java part of the System Preferences application. So if somehow you have the "wrong" version in use, you can fix it there. But by default, it seems in my experience to use the latest version (man java_home doesn't really say).
I have a jre installed installed in my windows.
When I use the command
java -version
I get the output -
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)
I can see only the major version 1.7.
How to know which version of JRE update it is ?
Calling java -version will give you the installed version, including the update number (here: 51):
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
It seems like you have the base version installed, so there is no update number:
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)
I guess the build gives you the update you have.
You can try this as well-
java -fullversion
Version number translation: 1.6.0_34 is, in English, Java 6 Update 34
Looking at this page from the release note: http://www.oracle.com/technetwork/java/javase/jdk7-naming-418744.html
It seems you have the 1st java 7 version.
Oracle periodically makes updates available and, when an update occurs, the version string will also include the update version number. So, JDK 7 update 4, or JDK 7u4, will have the version string "1.7.0_4".
Normally the jre folder is named something like 1.VersionNumber.0_UpdateNumber
For 64 bit you can find this folder under C:\Program Files (x86)\Java
If your version Number just look like this: 1.VersionNumber.0, this means that you have the first release of given Java Version.
Eclipse complains: JRE version is 1.6.0; version 1.7.0 or later is needed to run Google Plugin for Eclipse.
In the Terminal, java concurs:
> java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
But in System Preferences \ Java \ the Java Control Panel says Your system has the recommended version of Java: Java 7 Update 51
and points to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java.
Eclipse preferences show that the installed JRE is at:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
To point Eclipse to Java 7 (1.7.0), it's enough to change the preference:
What is the source of the discrepancy in Java versions? Is this an instance of having different PATHs between the command-line Mac and the windowed-Mac?
Edit
If I edit /usr/local/adt-bundle-mac-x86_64/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini by adding
-vm
"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
Eclipse refuses to start.
And yet this is indeed 1.7:
> "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java" -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
If you want to be certain of the JVM that is used to run Eclipse, you need to specify it in your eclipse.ini file, according to these instructions.
Installing this update might fix your problem:
http://support.apple.com/kb/dl1572