Have you considered writing a simple installer program to do what you want and deploying it via Java webstart?
Sun provide the deployjava.js java script to detect and install Java, there are some Sun docs on it here
<html>
<head>
<script language="javascript" src="http://java.com/js/deployJava.js" type="text/javascript"></script>
<script type="text/javascript">
function doCheck(){
if(!deployJava.versionCheck("1.6+")){
alert("Apologies, you do not have the correct version of Java installed. You will now be re-directed to Sun's appropriate Java installer.\n\nPlease install the Java Runtime Environment (JRE) version 1.6 or later and re-visit this page.\n\nThank you.")
deployJava.installLatestJRE()
}
else{
window.location = "<%=redirectJavaOkUrl%>"
}
}
</script>
</head>
<body onload="doCheck();">
</body>
</html>