What causes the pop-up "To view this web content, you need to install the Java Runtime Environment" 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:

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


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.
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:
  
  
  Open a Terminal Prompt
  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
  Change to the Agents directory, cd ~/Library/LaunchAgents/
  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

  From ~/Library/LaunchAgents/ execute

rm com.facebook.videochat.USERNAME.plist

  Also remove from Launch control with

launchctl remove com.facebook.videochat.USERNAME.updater

  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.