Hi Friends,
Lets see how to get the installed jre programmtically.
See consider if we have installed more than 1 jre then get to know which
JRE my program referring. Or you want to set up a conditional statement which checks for installed jre and execute accordingly.
Happy knowledge sharing.. :)
Lets see how to get the installed jre programmtically.
See consider if we have installed more than 1 jre then get to know which
JRE my program referring. Or you want to set up a conditional statement which checks for installed jre and execute accordingly.
public class JreVersion { public static void main(String[] args) { // return the jre version e.g. 1.7 String version = System.getProperty("java.version"); if(Float.parseFloat(version.substring(0,3)) > 1.6f) { MyDialog md = new MyDialog(); /* do your code here.. */ } else { String msg = "Please installed the JRE 1.7 or higher"; JOptionPane.showMessageDialog(null, msg); } } }some time we need this statement because our code is only supported in JRE higher then X.X so we need to get the version of JRE installed at client machine at run time..
Happy knowledge sharing.. :)
No comments:
Post a Comment