I'd like to use the deployJava.js tool to have Java automatically detect the currently installed JRE and install an updated version if necessary. My initial impression when reading about deployJava.js was that it would do this out of the box when you simply set a version number as a function parameter for the "runApplet" function. But this has never seemed to work.
Is it even possible to do this, and if so, how?
Here is my current code for launching my applet:
<script type="text/javascript" src="https://www.java.com/js/deployJava.js"></script>
<script type="text/javascript">
var attributes = {id:"applet", name:"TheApplet", code:"TheApplet"};
var parameters = {jnlp_href: "http://localhost/TheApplet.jnlp"};
deployJava.runApplet(attributes, parameters, "1.6.0_31");
</script>
Thanks
I'm sure there's some way to get deployJava.installLatestJRE() to work, but in my tests it seems to do absolutely nothing.
But as a workable solution I simply used the deployJava.versionCheck() function to check for the required version and then used JavaScript to forward the user to "http://java.com/en/download/testjava.jsp" where they can then download the latest version, if necessary.
<script type="text/javascript" src="https://www.java.com/js/deployJava.js"></script>
<script type="text/javascript">
if (deployJava.versionCheck("1.6.0_31+") == false) {
userInput = confirm(
"You need the latest Java(TM) Runtime Environment. " +
"Would you like to update now?");
if (userInput == true) {
window.location = "http://java.com/en/download/testjava.jsp";
}
}
else
{
var attributes = {id:"applet", name:"TheApplet", code:"TheApplet"};
var parameters = {jnlp_href: "http://localhost/TheApplet.jnlp"};
deployJava.runApplet(attributes, parameters, "1.6.0_31");
}
</script>