code_junkie

How to check JRE version prior to launch?

Nov 11th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <!--
  4. ###############################################################################
  5. #
  6. # @(#)draw.jnlp 1.6 02/09/11
  7. #
  8. # JNLP File for Draw Demo Application
  9. #
  10. ###############################################################################
  11. -->
  12.  
  13.  
  14. <jnlp spec="0.2 1.0"
  15. codebase="http://java.sun.com/javase/technologies/desktop/javawebstart/apps"
  16. href="draw.jnlp">
  17. <information>
  18. <title>Draw 4 App</title>
  19. <vendor>Sun Microsystems, Inc.</vendor>
  20. <homepage href="http://java.sun.com/javase/technologies/desktop/javawebstart/demos.html"/>
  21. <description>A minimalist drawing application along the lines of Illustrator</description>
  22. <description kind="short">Draw Demo Short Description</description>
  23. <icon href="images/draw.jpg"/>
  24. <offline-allowed/>
  25. </information>
  26. <resources>
  27. <j2se version="1.3+" href="http://java.sun.com/products/autodl/j2se"/>
  28. <j2se version="1.3+"/>
  29. <jar href="draw.jar" main="true" download="eager"/>
  30. </resources>
  31. <application-desc main-class="Draw"/>
  32. </jnlp>
  33.  
  34. Properties sProp = java.lang.System.getProperties();
  35. String sVersion = sProp.getProperty("java.version");
  36. sVersion = sVersion.substring(0, 3);
  37. Float f = Float.valueOf(sVersion);
  38. if (f.floatValue() < (float) 1.4) {
  39. System.out.println("Java version too low ....");
  40. System.exit(1);
  41. }
  42. ...
  43.  
  44. var list = deployJava.getJREs();
  45. var result = "";
  46. result = list[0];
  47. for (var i=1; i<list.length; i++)
  48. {
  49. result += ", " + list[i];
  50. }
  51. document.write("jre version : "+result);
Add Comment
Please, Sign In to add comment