I recently read in a book on a Java-based technology that one can determine if the JDK is installed by running java -version and looking for the the Strings "Client" or "Server" in the output of the version command. The authors of that book state that the presence of "Server VM" means the JDK is installed and the presence of "Client VM" means that the JDK is not installed (presumably implying that the JRE only is present because something is returned). Unfortunately, that is not a sufficient way to determine presence of the JDK.
Read more ...