Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Forked from dderusha/javaJDKextAtty.txt
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/ff02568d2d6d3f4f0c20 to your computer and use it in GitHub Desktop.
Save rtrouton/ff02568d2d6d3f4f0c20 to your computer and use it in GitHub Desktop.
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