Java check latest version programmatically

前端 未结 9 1679
不思量自难忘°
不思量自难忘° 2020-12-14 02:36

Goal: check java\'s version on a machine (I can get this from java -version). Compare it with latest available from java website

I woul

9条回答
  •  渐次进展
    2020-12-14 03:21

    UPDATE: I don't recommend this method because this JRE is the one that has the Ask.com toolbar. You're better off downloading it yourself and distributing it yourself.

    The jusched.exe program accesses the following URL to find out what versions are available. I think it's less likely to change because jusched is installed on millions of computers.

    https://javadl-esd-secure.oracle.com/update/1.7.0/map-m-1.7.0.xml

    Here is a snippet of what it returns for me:

    
    
    
          
          1.7.0_17
          https://javadl-esd-secure.oracle.com/update/1.7.0/au-descriptor-1.7.0_25-b17.xml
       
       
          1.7.0_21
          https://javadl-esd-secure.oracle.com/update/1.7.0/au-descriptor-1.7.0_25-b17.xml
       
       
    

    To get the actual version that it is pointing to you have to fetch the above URL. Here is another snippet of what this XML looks like:

    xml version="1.0" encoding="UTF-8" standalone="yes"?>
    
    
      
        Java Update - Update Available
        Java Update Available
        Java 7 Update 25 is ready to install. Installing Java 7 Update 25 might uninstall the latest Java 6 from your system. Click the Install button to update Java now.  If you wish to update Java later, click the Later button.
        http://java.com/moreinfolink
        Java Update Available
        A new version of Java is ready to be installed.
        More information...
        http://javadl.sun.com/webapps/download/GetFile/1.7.0_25-b17/windows-i586/jre-7u25-windows-i586-iftw.exe
        1.7.0_25-b17
        https://nometrics.java.com
        http://rps-svcs.sun.com/services/countrylookup
        
        /installmethod=jau FAMILYUPGRADE=1 SPWEB=http://javadl-esd.sun.com/update/1.7.0/sp-1.7.0_25-b17
        24595ec7f861bc67e572f1e4ad3992441335e1a7
      
    
    

    The version tag contains the full version number.

提交回复
热议问题