Monday, March 8, 2010

Quiet Alternative to jucheck.exe (Java Update Check)

I want to make sure my Java is updated, but I don't want jusched.exe running in the background for no reason, and jucheck can't be configured to pop a message box only when there's a new version available.

So I wrote this small batch script to check the latest version.
To run it you'll need curl in your PATH.

I schedule this script to run when the computer is idle for an hour, using nircmd exec hide <path to javacheck.cmd> to make the update check invisible.
@echo off
echo Checking if there's a Java update...
curl http://javadl-esd.sun.com/update/1.6.0/map-m-1.6.0.xml | findstr au-descriptor-1.6.0_20 >nul
REM if grep failed it probably means there's a new version - launch update interface
if errorlevel 1 (
"%CommonFiles%\java\java update\jucheck.exe"
) else (
echo Java is up to date!
)
view raw javacheck.cmd hosted with ❤ by GitHub


P.S Whenever Java does update, make sure to edit the script according to the latest version number (look in http://javadl-esd.sun.com/update/1.6.0/map-m-1.6.0.xml ).