How do I find where Java is installed?
From InstallJammer Wiki
The Locate Java Runtime action is built for just this purpose. You can specify a Minimum Version of Java that you want to find (1.6 for example), and the action will attempt to search the system in a given manner to find the version you are looking for.
This action sets several variables as a result of its search. You can read about them in the documentation for this action. The most important variable is <%JavaFound%>, which tells you whether Java was found or not for the version you wanted.
Use a String Is Condition to check whether <%JavaFound%> is true or false and do whatever you want.
