one of my friend is making projects which included java functionality, he was asking me that is there any way to dectect java runtime files from windows machine. If java exists that script should return its path, but if doesn't than it should prompt that Java runtime files not found.

as u had seen while installing apache tomcat it detects is JDK is installed on that PC or not. if it is not found than it quits the installation and incase JDK is installed it prompts user and continue its installation.

anyhelp will be appreciated.