Search code examples
javajavascriptappletjnlpjava-deployment-toolkit

Deployment Toolkit for Java applets: how to avoid the redirect when no JVM is installed


I have created an applet; it is deployed using the Deployment Toolkit as below (the URLs are fake):

<script type="text/javascript" 
             src="https://www.java.com/js/deployJava.js"></script>
<script>
var attributes = {
        code:'br.com.brandizzi.adam.applet.MyApplet.class',
        archive:'http://adam.brandizzi.com.br/html/applet.jar',
        width : 50,
        height : 1
    };
    var parameters = {
        fontSize : 1,
    };
    var version = '1.6';
    deployJava.runApplet(attributes, parameters, version);
</script>

It works well. Luckily, however, I reached my site through a machine without JVM and it was always redirected to http://www.java.com - as the documentation states:

If the client does not have the required minimum version of the JRE software, the Deployment Toolkit script redirects the browser to http://www.java.com to allow users to download the latest JRE software. On some platforms, users might be redirected before they can view the web page containing the applet.

Is there a way to avoid this redirect? The page can work great without JVM, the applet is just a little improvement. Anyway, our users can become very confused with this redirect and they not even have permissions to install JVM.


Solution

  • The whole point of using the Deployment Toolkit is that it prompts the user to install a JVM if they don't have one, so that your applet can run. If you don't want them to be prompted, then simply don't use the Deployment Toolkit.

    If they have a suitable JVM installed already then your applet will run. If not, the remainder of the page should load normally.