3

I have an application that is having problems with some java old versions, I would like to know if there is a URL (that's not a web page for humans) that I could check and parse to know if there is a new version of java.

I want to do inform the user that there is a new version of java every time a new one is released. My application is done for Windows and Mac so it would be nice if this URL could give me information about different platforms.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
  • 1
    How is it deployed? If you use java webstart it can be done automatically. – assylias Jan 12 '13 at 17:53
  • It's a jar file wrapped into a executable (launch4j or Jar Bundler) – Hola Soy Edu Feliz Navidad Jan 12 '13 at 17:54
  • 2
    I think this is your best bet, you prolly modify it or rewrite the key pieces are parse out the information you need: http://stackoverflow.com/questions/12952699/java-check-latest-version-programatically – MatthewJ Jan 12 '13 at 17:55
  • Thank you for the url, but ¿isn't there anything done for machines like an XML or Web Sevice? – Hola Soy Edu Feliz Navidad Jan 12 '13 at 18:00
  • I assume you're relying on a JRE external to the application. There is potential for mess because there are multiple JVM vendors with different release cycles. The JRE the application is running on might not belong to the vendor whose service you would check. – McDowell Jan 12 '13 at 19:28
  • Thanks for the advise, but I don't care, just want a place where I can check if there is newer version. – Hola Soy Edu Feliz Navidad Jan 12 '13 at 19:50
  • @HolaSoyEduFelizNavidad - If Oracle doesn't offer such a service, I would try using network sniffing tools to see how the JRE performs its update check. – McDowell Jan 12 '13 at 20:50

3 Answers3

2

The answer is simple but unsatisfactory: no, there isn't. A work around might be if you embed a JEditorPane (possibly hidden), direct it to http://java.com/en/download/testjava.jsp, parse the content and look for "An old version of Java has been detected on your system." or so.

Update

I monitored the network traffic from testjava.jsp. Turns out it requests this URL http://java.com/applet/JreCurrentVersion2.txt which currently returns 1.7.0_10...which is the latest and greatest, indeed.

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
2

http://javadl-esd-secure.oracle.com/update/baseline.version seems to be a replacement to the JreCurrentVersion2.txt.

Which currently returns

20.0.2
19.0.99
18.0.99
...

As hinted in https://stackoverflow.com/a/40145277/184201

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
0

Java can tell you what version of java the client machine is running. I don't think the browser can discover this without running an applet. A Web service is running on some remote server; I would find it disturbing if that server could tell you what version of java the local machine is running.

Your application can display an error message if the user has an older version of java. Otherwise JNLP is a greatest out of the box solution. See http://javatester.org/version.html

The code to determine your java version is simple : System.getProperty("java.version")

Thorn
  • 4,015
  • 4
  • 23
  • 42
  • It's not an applet, its a desktop application, and I've already got the client version, I just want a place to tell the user that there is a new version of java available – Hola Soy Edu Feliz Navidad Jan 12 '13 at 19:21
  • Right, and the link I provided tells you how to do that from within your application. My point is that a java client (desktop, JNLP, or applet) needs to tell you this. – Thorn Jan 13 '13 at 00:03