Skip to main content
Jamf Nation, hosted by Jamf, is a dynamic and knowledgeable community of Apple-focused IT admins and Jamf Pro users. Join us in person, in October, for the annual Jamf Nation User Conference (JNUC) to discover new and better ways to manage Apple devices.

Handle the java version check during recon better

Fresh Macs out of the box do not include java anymore. But Jamf looks for java during recon. So what ends up happening is you get this pop-up:

Clicking "More Info" and installing that version doesn't actually solve the issue and you'll still get the pop-up on future recons. You have to install a JDK to actually get rid of the pop-ups. I have been installing a JDK in my default suite of apps every Mac we build gets, but this requires updating for new versions and whatnot. This also opens the machine up for security holes (which is why I stopped installing Flash by default as well).

The jamf binary should look for java in a better way then just running "jamf version" and looking for the result of that, which leads to the error above. You can verify that's the cause by running it manually in Terminal:

One option would be to use "/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home -d64" If it's not installed, you get the following output (but no pop-up):

Once a version is installed, you get the path in the output:

Comment
CCA Badge CMA Badge

Posted: 10/13/17 at 8:16 AM by bvrooman

I've not seen this behavior. Is it possible that you've created an Extension Attribute which is calling the Java binary during a recon?

Like
CCA Badge CMA Badge

Posted: 10/13/17 at 1:11 PM by mahughe

agreed, I've never seen this in 10 yrs ..

Like
CCA Badge

Posted: 10/13/17 at 3:12 PM by mm2270

Me neither. I've only seen it happen when an Extension Attribute is created that uses java -version which is what I suspect is happening. As far as I know, Jamf Pro does not natively collect info on installed Java version, unless it's something that's part of the Patch Reporting, but I doubt it. I'm thinking that probably uses something like:

defaults read /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Info.plist CFBundleVersion

Check your Extension Attributes.

Like

Posted: 10/16/17 at 8:41 AM by PhillyPhoto

It was an EA... I feel kind of foolish now lol.

The existing EA:

#!/bin/bash

java_version=`java -version 2>&1 | head -n 1 | cut -d\" -f 2`

echo "<result>$java_version</result>"

exit $?

My reconfigured EA:

#!/bin/bash

java_home=`/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home -d64`

if [[ $java_home == "" ]]; then
    java_version="NOT Found"
else
    java_version=`java -version 2>&1 | head -n 1 | cut -d\" -f 2`
fi

echo "<result>$java_version</result>"

exit $?
Like