How to check JRE version prior to launch?

前端 未结 13 2237
天命终不由人
天命终不由人 2020-12-01 11:08

What\'s the best way to determine if the version of the JRE installed on a machine is high enough for the application which the user wants to run? Is there a way of doing it

13条回答
  •  独厮守ぢ
    2020-12-01 12:11

    You might consider Java Webstart. Even if the name implies something like applets, it's about standalone-applications. Webstart is a launcher, that checks a JNLP-file (a simple XML-file, where you configure the download-location of your app, the needed Java-version and some other metadata) and starts your app with the correct JRE. It even updates the application, if a newer version is available. The downside is, you have to write a JNLP-file. Here is an example:

    
    
    
    
    
    
        
          Draw 4 App 
          Sun Microsystems, Inc.
          
          A minimalist drawing application along the lines of Illustrator
          Draw Demo Short Description
          
           
        
       
          
          
          
       
       
     
    

    A second possibility is to use a launcher-program. An example is the Apache Commons Launcher. You can also write some launcher app yourself, but that's usually not worth the effort.

提交回复
热议问题