MacOS – What causes the pop-up “To view this web content, you need to install the Java Runtime Environment”

javamacosstartup

On OSX Yosemite an annoying pop-up comes up quite often saying:

To view this web content, you need to install the Java Runtime Environment

I know the solution is to install java; however I'm wondering what's the cause for that.

A quick ps -axww tells me:

13218   ??  S      0:00.29 /System/Library/Java/Support/CoreDeploy.bundle/Contents/Download Java Components.app/Contents/MacOS/Download Java Components

I dug around and I found that there is a LaunchDaemon that references this in /System/Library/LaunchAgents/com.apple.java.InstallOnDemand.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.apple.java.InstallOnDemandAgent</string>
    <key>MachServices</key>
    <dict>
        <key>com.apple.java.installondemand</key>
        <true/>
    </dict>
    <key>Program</key>
    <string>/System/Library/Java/Support/CoreDeploy.bundle/Contents/Download Java Components.app/Contents/MacOS/Download Java Components</string>
    <key>RunAtLoad</key>
    <false/>
</dict>
</plist>

Does anyone know what is the purpose of all this? The pop-up appears at random times, which makes me think there's a background daemon that demands Java to run but I could not find any source for this behaviour.

Best Answer

For my sister this was caused by Facebook videochat. We debugged quite randomly, and could not find a way to tell what triggered this dialog; like indeed ps did not show what started it. But the following Apple Support Communities post explained how to find it by trial and error:

Here are the steps I used to correct, as even after removal from Launch control it kept returning on reboot:

  1. Open a Terminal Prompt
  2. Show non Apple startup Agents. At $ execute

    launchctl list | grep -v apple
    

    This will look something like the following.

    PID Status Label
    -   0      org.openbsd.ssh-agent
    282 0      com.symantec.symsecondarylaunch.application
    274 0      com.symantec.quickmenu.application
    -   0      com.google.keystone.system.agent
    -   0      com.valvesoftware.steamclean
    -   0      com.oracle.java.Java-Updater
    276 0      com.Logitech.Control Center.Daemon
    302 0      com.google.Chrome.62228
    -   1      com.facebook.videochat.USERNAME.updater
    295 0      com.symantec.scannotification.application
    -   0      net.tunnelblick.tunnelblick.LaunchAtLogin
    275 0      com.symantec.savdiskmountnotify.application
    317 0      net.tunnelblick.tunnelblick.119880
    

    One of the returned items is likely your issue, mine was also com.facebook.videochat.USERNAME.updater

  3. Change to the Agents directory, cd ~/Library/LaunchAgents/

  4. I also had to remove the actual agent files, as it kept re-appearing on reboot. You can view those on your system and remove. List out the items in directory: ls

    SharedServices.Agent.plist
    com.facebook.videochat.USERNAME.plist
    com.valvesoftware.steamclean.plist
    net.tunnelblick.tunnelblick.LaunchAtLogin.plist
    org.virtualbox.vboxwebsrv.plist
    
  5. From ~/Library/LaunchAgents/ execute

    rm com.facebook.videochat.USERNAME.plist
    
  6. Also remove from Launch control with

    launchctl remove com.facebook.videochat.USERNAME.updater
    
  7. Exit and reboot

If I recall correctly then this videochat thing might also have been a plugin in her browser, which we then already removed earlier.