A browser with JavaScript enabled is required for this page to operate properly.
Trail: Deployment
Lesson: Deployment In-Depth
Section: Deployment Toolkit
Checking the Client JRE Software Version
Home Page > Deployment > Deployment In-Depth

Checking the Client JRE Software Version

There are many reasons to check if a particular version of the Java Runtime Environment (JRE) software is available on a client machine. For example, you might want to launch a different version of your rich Internet application (RIA) or redirect the user to a different page depending on the client's JRE software version.

Use the Deployment Toolkit script's versionCheck function to check if a particular version or range of JRE versions is installed on the client.

Function signature: versionCheck: function(versionPattern)

Parameters:

Usage: Creating a different user experience depending on the client's JRE software version

In this example, a Launch button is created for the Notepad application only if the version of JRE software on the client is greater than or equal to 1.6. If not, the browser is redirect them to java.sun.com.

   
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
    if (deployJava.versionCheck('1.6+')) {            
        var url = "http://java.sun.com/javase/technologies/desktop/javawebstart/apps/notepad.jnlp";
        deployJava.createWebStartLaunchButton(url, '1.6.0'); <!-- you can also invoke deployJava.runApplet here -->
    } else {
        document.location.href="http://java.sun.com";
    }
</script>		


Note: Depending on the client's operating system and version of the Java platform, you might be able to verify version information for JRE software at the major version level (for example, 1.6) or at a finer update level (for example, 1.6.0_10).

Problems with the examples? Try Compiling and Running the Examples: FAQs.
Complaints? Compliments? Suggestions? Give us your feedback.

Previous page: Deploying Without Codebase
Next page: Java Network Launch Protocol