I have a MacBook Pro running Snow Leopard; how can I see what version of the Java SDK is installed on my Mac?
Open a terminal and type: java -version, or javac -version.
If you have all the latest updates for Snow Leopard, you should be running JDK 1.6.0_20 at this moment (the same as Oracle's current JDK version).
In /System/Library/Frameworks/JavaVM.framework/Versions you'll see all the installed JDKs. There is a symbolic link named CurrentJDK pointing the active JDK.
The simplest solution would be
open terminal
$ java -version
it shows the following
java version "1.6.0_65"
Stefan's solution also works for me. Here's the exact input:
$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ ls -l
Below is the last line of output:
lrwxr-xr-x 1 root wheel 59 Feb 12 14:57 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
1.6.0.jdk would be the answer
On modern macOS, the correct path is /Library/Java/JavaVirtualMachines.
You can also avail yourself of the command /usr/libexec/java_home, which will scan that directory for you and return a list.
Which SDKs? If you mean the SDK for Cocoa development, you can check in /Developer/SDKs/ to see which ones you have installed.
If you're looking for the Java SDK version, then open up /Applications/Utilities/Java Preferences. The versions of Java that you have installed are listed there.
On Mac OS X 10.6, though, the only Java version is 1.6.
Run this command in your terminal:
$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
Cristians-MacBook-Air:~ fa$
Related
I am running Ubuntu 16 on my computer and
I am attempting to run a Java application on my computer and I get the following error:
No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 11.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
However I have already Java installed and a virtual machine.
When I press
$java -version
I get the following output:
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (Zulu 8.33.0.1-linux64) (build 1.8.0_192-b01)
OpenJDK 64-Bit Server VM (Zulu 8.33.0.1-linux64) (build 25.192-b01, mixed mode)
Does anyone know how I can fix this problem? Many thanks.
Compare
The version of the JVM must be at least 11
and
openjdk version "1.8.0_192"
(i.e. Java 8)
Upgrade your Java version.
From the output above, it is evident that an updated version of Java is missing. You need at least a version of JVM equal to 11 or upper.
Let’s now proceed and install both JRE and JDK which both constitute JAVA
JRE
Ubuntu
sudo apt install default-jre
Arch
sudo pacman -S jre-openjdk
JDK
Ubuntu
sudo apt install default-jdk
Arch
sudo pacman -sS java | grep jdk
sudo pacman -S jdk-openjdk
you can check the version with java -version
java -version
Trying to install eclipse
and I get an error
Version 1.6.0_65 of the JVM is not suitable for this product.
Java -version from command line says
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
How can I change that to a compatible version? I did google this and cruise this site for answers with the suggested questions when writing this but was not able to find something that solved it. I found a few answers telling you to do this (with my current installed version in)
export JAVA_HOME=`/usr/libexec/java_home -v 1.8.*'
When I run the EXPORT command it just takes me to a command line and from there I have no idea what to do.
I did download the 64-bit version.
Seems like it should be an easy thing to do....
Right click Eclipse and click Show Package Contents
And open Contents\info.plist in a texteditor
Then search for <key>Eclipse</key> and immediately after the <key>Eclipse</key> you will have <array> tag, add the following inside <array> tag.
<string>-vm</string>
<string>YOUR_JAVA_HOME/jre/lib/server/libjvm.dylib</string>
Replace YOUR_JAVA_HOME with the output of /usr/libexec/java_home -v 1.8.*. Then eclipse will run on that particular JVM.
For example my Info.plist has the following
<key>Eclipse</key>
<array>
<string>-vm</string>
<string>/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/server/libjvm.dylib</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
<string>-showlocation</string>
</array>
Oct 14 - got the same error.
You can actually get rid of all the problems by simply installing the appropriate JDK. Make sure you install the full SDK and not the JRE. See Link below.
This worked for me - now I'm able to install Eclipse Mars.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I was having the same problem. My system:
OS X Yosemite
Version 10.10.5
$ /usr/libexec/java_home
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
$ java -version
java version "1.6.0_65"
But www.java.com/verify/ says I have Version 8!? Clearly I have a two versions that are not configured correctly.
Here is how I fixed it:
Make sure you download the Oracle version of the JDK from a .dmg file. I
installed Java SE JDK for Mac OS from
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Then I told java_home to use this new version:
$ /usr/libexec/java_home -v jdk1.8.0_111 --exec javac -version
Now:
$ java -version
java version "1.8.0_111"
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
1.8.0_111, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
1.6.0_65-b14-466.1, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-466.1, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
... and the Eclipse install works great!
Had the same problem. Had downloaded the JRE by mistake because that's what Oracle recommended. Make sure you have the SDK. It's about 500mb.
For Eclipse mars minimum Java required is Java 7 refer the below site
Eclipse/Installation
You can disable System Integrity Protection and then install the newest version of Java. To disable System Integrity:
Restart your Mac.
Press "Command + R".
In the menu bar, find Utilities, and open Terminal.
Type "csrutil disable; restart".
You can disable System Integrity Protection and then install the newest version of Java. To disable System Integrity:
Restart your Mac.
Press Command + R.
In the menu bar, find Utilities, and open Terminal. Type
csrutil disable; restart.
I installed java 7 (both the JDK and the JRE) on a MAC (OSX 10.10.3). java preferences shows the installed version correctly (1.7.0_80) as does the output of "java -version". However it seems some path/ environment variables are not updated since /System/Library/Frameworks/JavaVM.framework/Versions is still showing only up to 1.6 and not 1.7. Programs like Eclipse that are specifically looking for Java 7 or later in this path are hence failing to run.
Any suggestions ?
It's in a different location now: /Library/Java/JavaVirtualMachines/.
For instance, on my machine:
$ ls /System/Library/Frameworks/JavaVM.framework/Versions
1.4 1.4.2 1.5 1.5.0 1.6 1.6.0 A Current CurrentJDK
$ ls /Library/Java/JavaVirtualMachines/
jdk1.7.0_67.jdk jdk1.8.0_20.jdk jdk1.8.0_45.jdk
I have a requirement where I have to run java application(.mpkg) with latest JRE version on Mac OS X Yosemite 10.10. And I have done the following steps.
I have installed the latest JRE from Oracle website.
Set the JAVA_HOME=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/ in ~./bash_profile and also ran shell command source ~./bash_profile
echo $JAVA_HOME is showing /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/
Java -version is providing output
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
But when I am running the .mpkg/installer I am getting exception pop up saying "To view this web content, you need to install the Java Runtime Environment."
Please suggest answers specific to the JRE.
Little background: Earlier, I had JDK1.6 installed on my Mac OS X Yosemite 10.10 machine. I had to uninstall it because I have to run my application with latest version of JRE. I uninstalled JDK1.6 by following steps:
sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.*
sudo rm -rf /Library/Java/JavaVirtualMachine/1.6*
sudo unlink /System/Library/Frameworks/JavaFrameEmbedding.framework/Versions/CurrentJdk
Note: The below points should be read keeping into mind that they are tested with Mac OS X 10.10.2 and Java 7 & 8.
I have observed the behavior of the installations of the JDK/JRE for Java 7 & 8 on Mac OS X 10.10(assuming this should go well with Mac OS X 10.7.3 and later, when Mac OS started supporting java 7 and later).
On a Mac machine, either JRE 7 or JRE 8 can be installed into the default location which is /Library/Internet Plug Ins/JavaAppletPlugin.plugin/.
As we upgrade from JRE 7 to JRE 8, the earlier version gets overridden from the system.
The command java -version wouldn't show any thing until you have installed JDK.
We can have two or more versions of JDK on the same system. They can be found from directory /Library/Java/JavaVirtualMachines/.
By default, the command java -version would always show the latest JDK installer on the system.
As we remove or upgrade the JDK from the system, java -version command shows the results accordingly.
As per my requirements, I never had to set the JAVA_HOME. As I stated above that JRE can be found from the path /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/ and in postscript I initiated my application using command /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
This way, we don't to remove the JDK1.6 from our system. Rather, if we are running our application with just java then make sure correct version of JDK is installed but if we are running our application using the JRE then make sure you provide the full path of the JRE /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
I seem to have a bit of a mess. At the terminal, I get:
> java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
Which is good (I'm trying to get Java 8 running). which java gives /usr/bin/java and:
> ls -al /usr/bin/java
/usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
Here I think I see where Java is actually installed.
Now my problem is that when I code a simple Java program and type:
System.out.println( System.getProperty("java.version") )
System.out.println( System.getProperty("java.vendor") )
I get the output:
1.6.0_65
Apple Inc.
So what am I doing wrong?
p.s. I am using Eclipse and while I can manually select a different JDK to use there, I would like Java 8 to be a system default. For example, I recently downloaded Eclipse Luna which does not open, giving the following error message:
Version 1.6.0_65 of the JVM is not suitable with this product.
Check the java home using:
/usr/libexec/java_home
Move to that directory:
cd /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
cd bin
java -version
To switch the jdk 8 you will need to modify /usr/libexec/java_home to correctly point to java 8.