Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Java JDK Extension Attribute
###Test Code###
### Intention is to figure out what JDK the user has installed.
### our current Ext atty reports the JRE, we need to know they have the JDK
## thanks to elliotjordon
## -00 is just a number to say that JDK is not installed. makes for better smartgroup searches
###############
if JDKver=$(ls "/Library/Java/JavaVirtualMachines" | awk -F "_|.jdk" '/.jdk/{print $2}' | tail -1)
then
echo "<result>$JDKver</result>"
# else
# echo "<result>-00</result>"
fi
@rtrouton
Copy link
Author

rtrouton commented Aug 4, 2015

Another approach is to to run:
/usr/libexec/java_home
That should give me will give the current jdk path, which I can check for the right output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment