You can use this library to check for updates via the RSS feed of the SourceForge.net site.
It uses the third party libraries jDom and commons lang from Apache.
This lib is released under GPL version 3.
Downloads are provided at: https://sourceforge.net/projects/sf-filechecker/files
Put the jar files on the classpath of your application.
These are:
The parameters are set in the file 'config.xml'.
Here is an example:
<?xml version="1.0"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <entry key="current.version"></entry> <entry key="rss.url">http://sourceforge.net/api/file/index/project-id/273173/mtime/desc/rss</entry> <entry key="regex">.*Wallpaper-Changer-([0-9]+\.[0-9]+(\.[0-9]+)?)_win32.exe.*</entry> </properties>
The simplest code is this:
LatestFilesMain l = new LatestFilesMain(); if (l.update()) { URL url = l.getLatest(); if (JOptionPane.showConfirmDialog(null, "A new version of the Wallpaper Changer is available!\nDo you wan't to download it now?", "New Version", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) { Desktop.getDesktop().browse(url.toURI()); } }
This code check for 'update()' and then shows a dialog that asks to download the new version.
Stefan Dotti, www.dotti.at, sourceforge.net/projects/sf-filechecker, sourceforge.net/users/stefandotti