MacOS – Can the Java SDK pop-up be disabled entirely

javamacos

Whenever an application attempts to use, or even check to see if Java is installed, a pop-up is generated that steals focus and tells you all about how to install the latest JDK. This is perhaps useful the first time, but when it repeatedly happens for things that just check to see if java is available, it's a huge annoyance.

(e.g. compiling various code from source, they often check for java among many other tests, to decide whether to build-in certain features at compile-time)

So what I'm after is a sensible way to disable the pop-up entirely. Ideally without changing system files that are likely to be overwritten/repaired by updates, or forcefully protected from change with System Integrity Protection in OS X 10.11 El Capitan.

Related questions

How to get to know which app causes the "would you like to install java?" dialog in Mavericks to appear? attempts to find a way to determine what is at fault—though in my case I generally know what's triggering the pop-up, I just don't want to see it since I already know that I don't want to install the JDK.

How does one detect if java is installed without triggering a visual prompt? is hopefully something developers will find, and enact, to detect java yet avoid the pop-up when its not actually necessary.

Best Answer

There is a stub app inside:

/System/Library/Java/Support/CoreDeploy.bundle

that shows the prompt to download Java. I believe you can rename CoreDeploy.bundle to stop the Java install prompts. Note that it's generally a bad idea to modify anything in /System and OS updates may undo anything you change there.

To test the prompt, in Terminal type

java -version

If you don't have JRE/JDK installed, you should be prompted. After you rename the file, try again and the prompt should not appear.