321

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?

Andrew
  • 227,796
  • 193
  • 515
  • 708
user2909913
  • 4,149
  • 5
  • 16
  • 11
  • 1
    I don't know what problem is there in terminal but I run eclipse and all projects are compiling fine in mavericks – Sunny Oct 23 '13 at 05:44
  • Do you see Java in the preferences ? – Sorter Oct 23 '13 at 05:52
  • 1
    it seems the old java launcher only support jdk 1.6 but mavericks doesn't have 1.6 installed by default. – Shawn Oct 23 '13 at 06:11
  • java -version command is running fine on mavericks. It was already installed in mountain lion. and there is no java option in system preference. – Sunny Oct 23 '13 at 15:02
  • 1
    You installed java 6, not java 7 as OP originally implied they needed. I am interested in how that solution is reached. Also there must be an 'alternatives' kind of approach here that directly addresses the feedback from the terminal. – Rondo Oct 25 '13 at 00:17
  • 4
    This is great for Java 6, but how can you get Java 7 to work? – 190290000 Ruble Man Oct 25 '13 at 01:35
  • 2
    Added a potential answer to install the Java 7 JRE and have it working in the Terminal: http://stackoverflow.com/a/19582689/346286 – analogue Oct 25 '13 at 06:46
  • @user2909913 You should remove the update part of the question and select the correct answer as accepted instead. – Jawa Jan 29 '14 at 10:30
  • It is incredible to me that what claims to be a modern operating system needs so much hand-holding. – Thanatos Nov 05 '14 at 17:49

11 Answers11

277

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

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.

Gray
  • 115,027
  • 24
  • 293
  • 354
Guy
  • 12,250
  • 6
  • 53
  • 70
  • Same for me. Another choice is to install Java from Oracle. Which one do you guys think is better? Oracle seems to have Java updated more quickly than Apple. – Ngoc Pham Oct 23 '13 at 14:29
  • 2
    but this one gives you JDK 6. how can we use JDK 6 directly? – Shawn Oct 24 '13 at 21:29
  • 2
    @Shawn Apple disables already installed JDK 7. But you can get some FAQ and install from here: https://www.java.com/en/download/faq/java_mac.xml but i did not try it out. – Guy Oct 25 '13 at 04:48
  • If you have installed both java6 and java7, you can select v6 in your shell with: export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home – Jürgen Strobel Oct 28 '13 at 13:34
  • If you want header files for compiling JNI modules or want to have the javadocs, you would need to download and install "Java for OS X 2013-005 Developer Package" from https://developer.apple.com/downloads/index.action – Arup Malakar Dec 16 '13 at 20:02
  • @mtomy 32-bit on OS X 10.9? don't think so. They might only include the 64 bit version. see: http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html#install – Guy Jan 12 '14 at 10:13
  • 1
    Why would you want to use 32 bit java on a 64bit OS? 64 bit java is actually faster than 32bit under Mavericks. – MiB Jan 23 '14 at 15:45
  • The link they direct you to in the popup doesn't work but this one does. Mind. Blown. – Brian Samson Nov 24 '14 at 20:36
  • Hope apple dont remove the java 6 version, need that for some legacy apps that dont work well with newer JVMs due to reliance on sun java classes (that should not be used but need to for some obscure reason) – tgkprog Jan 29 '15 at 18:23
  • Also see [HT202912, About Java for OS X 2014-001](http://support.apple.com/no-no/HT202912)" *"This article is about older, unsupported Java software. Download the latest version of Java for OS X directly from Oracle."* The older version its discussing is Java for OS X 2014-001. Are you sure your answer applies to Mavericks? – jww Feb 13 '15 at 18:10
197

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.

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
analogue
  • 3,160
  • 1
  • 21
  • 27
  • For Maverics Update the the file is at ~/.bash_profile. Once that is updated with the path above - restart your terminal to see your changes. – fino Oct 31 '13 at 04:04
  • 37
    I think it sounds a little fishy to define `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 https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/java_home.1.html. – Ilkka Nov 16 '13 at 16:20
  • 8
    @Ilkka - it does sound fishy, but that's actually where Oracle's JRE installs to. Apple's java (which stops at java 6) doesn't mix with oracle's quite as nicely as one might like – Orion Edwards Jan 10 '14 at 00:11
  • 12
    A colleague of mine (who unfortunately does not have the required reputation here to add comments) wants to add that the JAVA_HOME setting should be `export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home"` – Stephan Windmüller Jan 23 '14 at 10:48
  • 1
    I installed jdk7u45 from Oracle and still use export JAVA_HOME=$(/usr/libexec/java_home) in my bash profile. jdk7u45 works very nicely including the java system preference panel. Now I'm upgrading to jdk7u51. – MiB Jan 23 '14 at 15:47
  • I am talking about the JRE here, not the JDK – analogue Jan 24 '14 at 23:45
  • @analogue Correct but the OP is asking about the JDK – mmmmmm Feb 13 '14 at 11:58
  • 2
    I had to add `export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"` to ~/.profile instead of ~/.bashrc or ~/.bash_profile to get this work. – LarS May 10 '14 at 15:19
  • @Ilkka Doesn't detect JRE8 anymore. – Paul-Sebastian Manole Nov 26 '14 at 16:49
  • where is it installed? – Dejell Jan 01 '15 at 14:39
  • 1
    How do I give you money? Thank you. This is exactly what I needed. – Geoffrey Hale Nov 16 '17 at 03:49
64

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.

Marco Massenzio
  • 2,822
  • 1
  • 25
  • 37
  • 4
    See [my comment to another answer](http://stackoverflow.com/questions/19533528/installing-java-on-os-x-10-9-mavericks#comment29812677_19582689) for what is perhaps a better way to get that path. – Ilkka Nov 16 '13 at 16:21
  • 1
    Since this answer has more upvotes, the bit that says `sudo ln -snf` in the answer above is not accurate anymore. That is actually referring to the answer by [Mr. Ronald](http://stackoverflow.com/a/19729259/399435) – Karthic Raghupathi Dec 22 '13 at 05:24
  • @KarthicRaghupathi I'm not sure I fully understand the comment (the use of `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. – Marco Massenzio Dec 23 '13 at 07:29
  • @Marco Now that you mention it, when I read my own comment, it does not really make much sense. :) Allow me to clarify. In your answer, you write "Afterwards, you will need to do the `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. – Karthic Raghupathi Dec 23 '13 at 16:56
  • Edited - but not actually sure that the re-ordering really happens: they all seem to be where they were, regardless of upvotes. NVM – Marco Massenzio Dec 25 '13 at 02:41
  • If you instead set `JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"` then it will still be correct if/when you upgrade your JDK. – Peter Gluck Jan 10 '14 at 06:09
  • @Peter - I'm not sure that that would work (in fact, I'm almost sure it won't): it assumes that the "insane maze of hyperlinks" is correctly set, and, as I mentioned, life is too short... – Marco Massenzio Jan 11 '14 at 07:04
  • @Marco, it does work (or my installation would be broken, which it isn't) and we are actually talking about symbolic file links, not hyperlinks. – Peter Gluck Jan 12 '14 at 01:45
  • Intellij 13 CE runs fine on Oracle jdk7u46 64bit on my OS X Mavericks 10.9.1 machine. I don't have java 6 installed and did not have to do any hacking to get this to work. Some older apps with java 6 library dependencies doesn't work, but java development (Eclipse) is significantly faster and better than on jdk 6. If you're a developer use jdk7 and upgrade your code base if needed. – MiB Jan 23 '14 at 15:35
  • Eclipse brings its own compiler and can run on a JRE. Netbeans and Idea require a full JDK. – Thorbjørn Ravn Andersen Apr 20 '16 at 05:45
14

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.

Mr. Ronald
  • 687
  • 4
  • 13
4

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>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Fabio Fumarola
  • 430
  • 3
  • 9
  • This did it for me. My problem was when I updated to osx 10.9, I could still access java from the terminal and everything else (including eclipse worked fine). Only Android Studio was causing this error. – ucsunil Sep 06 '14 at 08:10
  • This didn't work for me on OS X 10.10.1, it complains that no version 1.8 is available (even if the JRE 8 is properly installed). – Emmanuel Bourg Nov 28 '14 at 15:11
  • Did you check if JAVA_HOME is set? – Fabio Fumarola Dec 21 '14 at 14:40
3

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:

enter image description here

jww
  • 97,681
  • 90
  • 411
  • 885
user260628
  • 39
  • 1
3

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

Rondo
  • 3,458
  • 28
  • 26
  • We should not assume that Apple's current distribution of Java 6 is unsupported. – Graham Perrin Nov 03 '13 at 07:22
  • I placed the word 'supported' in quotes so as to avoid trying to tease out a complicated issue. Oracle charges for any support of 6... and that support charge would logically apply to Apple, as well; so, Apple is 'on its own' without a contract. Do they have one, *and* plan to work thru the patches for MacOSX? Does the contract still allow for re-distribution? Now there have been 2 Java 7 updates from Oracle since Apple's last update to 6. Historically, they tend to lock-step releases. Assumption, perhaps; A safe assumption? Seems so. – Rondo Jan 10 '14 at 22:38
3

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)

Community
  • 1
  • 1
Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
1

From the OP:

I finally reinstalled it from Java for OS X 2013-005. It solved this issue.

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
1

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.

sapy
  • 8,952
  • 7
  • 49
  • 60
0

There isn't any need to install the JDK, which is the developer kit, just the JRE which is the runtime environment.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dmz
  • 1
  • 6
    That's true. However, what Apple provide is the JDK and the JRE from Oracle is just there for the Internet Plugin, the `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. – Ngoc Pham Oct 23 '13 at 17:36