I presume you don’t have BFI?
See here for a BigFix Platform approach: Querying Install Locations of Java - #2 by trn