Use deployJava.js to check for/automatically install latest JRE version for web applet
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>
Pryo
Updated on June 23, 2022Comments
-
Pryo almost 2 years
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
-
ChrisWhoCodes over 11 yearsThis is a nice way to override the current deployJava.js behaviour when no Java is installed which refreshes the applet page once a second while taking 2-3 minutes to download and install the current JRE.
-
NawazSE about 9 yearsHow can I run a java program(but not an applet) which will launch a desktop icon after setting up the required JRE installed/updated.