I have installed the JDK on Mac OS X v10.8 (Mountain Lion). When I upgraded it to Mac OS X v10.9 (Mavericks) and ran java -version
in the terminal, it showed:
No Java runtime present, requesting install.
Then I manually installed the JDK (1.7) on my Mac. It seems that the installation worked fine. When the installation was done, I opened the terminal and typed java -version
as well. It also showed the same error:
No Java runtime present, requesting install.
How can I solve this problem?
The new Mavericks (10.9) showed me the "Requesting install", but nothing happened.
The solution was to manually download and install the official Java package for OS X, which is in Java for OS X 2013-005.
Update: As mentioned in the comments below, there is a newer version of this same package:
Java for OS X 2014-001 (Correcting dead line above)
Java for OS X 2014-001 includes installation improvements, and supersedes all previous versions of Java for OS X. This package installs the same version of Java 6 included in Java for OS X 2013-005.
If you only want to install the latest official JRE from Oracle, you can get it there, install it, and export the new JAVA_HOME in the terminal.
Open your Terminal
java -version gives you an error and a popup
Get the JRE dmg on http://www.oracle.com/technetwork/java/javase/downloads/index.html
Install it
In your terminal, type: export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
java -version now gives you java version "1.7.0_45"
That's the cleanest way I found to install the latest JRE.
You can add the export JAVA_HOME
line in your .bashrc
to have java
permanently in your Terminal:
echo export JAVA_HOME=\"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home\" >> ~/.bashrc
JAVA_HOME
to point at what is clearly a browser plugin instead of the real VM. When you install the XCode command line tools, you get a tool for getting the correct path, /usr/libexec/java_home
. See developer.apple.com/library/mac/documentation/Darwin/Reference/….
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home"
export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
to ~/.profile instead of ~/.bashrc or ~/.bash_profile to get this work.
The right place to download the JDK for Java 7 is Java SE Downloads.
All the other links provided above, as far as I can tell, either provide the JRE or Java 6 downloads (incidentally, if you want to run Eclipse or other IDEs, like IntelliJ IDEA, you will need the JDK, not the JRE).
Regarding IntelliJ IDEA - that will still ask you to install Java 6 as it apparently needs an older class loader or something: just follow the instructions when the dialog pop-up appears and it will install the JDK 6 in the right place.
Afterwards, you will need to do the sudo ln -snf
mentioned in the answer above:
sudo ln -nsf /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents \
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
(copied here as it was mentioned that "above" may eventually not make sense as answers are re-sorted).
I also set my JAVA_HOME
to point to where jdk_1.7.0_xx.jdk
was installed:
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home"
Then add that to your PATH
:
export PATH=$JAVA_HOME/bin:$PATH
The alternative is to fuzz around with Apple's insane maze of hyperlinks, but honestly life is too short to bother.
sudo ln -snf
in the answer above is not accurate anymore. That is actually referring to the answer by Mr. Ronald
this
and that
is somewhat confusing) but you still need a symlink from the /Sytem/Library/etc place to the actual place where Oracle installs the JVM (/Library/etc.) or applications will be unable to find the Java runtime.
sudo ln -snf
mentioned in the answer above;". Answers move up or down based on the number of up votes they get. My intention was to only provide a direct reference to the answer that had the sudo ln -snf
command.
I downloaded and installed the JDK 1.7 from Oracle. In the console / in Terminal Java 7 works fine.
When I start a Java program (like Eclipse) via the GUI, I get:
To open "Eclipse.app" you need a Java SE 6 runtime. Would you like to install one now?
Because I did not want to install old Java version, I used the following workaround:
sudo ln -nsf /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
Credits to monkehWorks.
ln -snf
because I got Operation not permitted
with ln -sf
This error happens because the plist file of IntelliJ IDEA requires Java version 1.6*. To solve this problem, replace the 1.6* with 1.8*.
<key>JVMOptions</key>
<dict>
<key>ClassPath</key>
...
<key>JVMVersion</key>
<string>1.8*</string>
<key>MainClass</key>
<string>com.intellij.idea.Main</string>
<key>Properties</key>
<dict>
The OP implied that Java 7 was the need. And Java 6 is in fact no longer being 'supported' so 7 is the version you should be installing at this point unless you have legacy app concerns.
You can get it here: http://java.com/en/download/mac_download.jsp?locale=en
My experience for updating Java SDK on OS X 10.9 was much easier.
I downloaded the latest Java SE Development Kit 8
, from SE downloads and installed the .dmg file. And when typing java -version
in terminal the following was displayed:
java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
I downloaded manually to here: Java for OS X 2014-001.
After that open your terminal and check the installation with java -version
.
EDIT (January, 2015): Also see HT202912, About Java for OS X 2014-001:
https://i.stack.imgur.com/LUVkY.png
From the OP:
I finally reinstalled it from Java for OS X 2013-005. It solved this issue.
This error means Java is not properly installed .
1) brew cask install java (No need to install cask separately it comes with brew)
2) java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
P.S - What is brew-cask ? Homebrew-Cask extends Homebrew , and solves the hassle of executing an extra command - “To install, drag this icon…” after installing a Application using Homebrew.
N.B - This problem is not specific to Mavericks , you will get it almost all the OS X, including EL Capitan.
There isn't any need to install the JDK, which is the developer kit, just the JRE which is the runtime environment.
java
command is not linked system-wide automatically so you still see the "No Java runtime present, requesting install." when you type java -version
in the Terminal.
Success story sharing