how to check jre version using java application

前端 未结 6 943
死守一世寂寞
死守一世寂寞 2020-12-19 01:49

i have made an application in JDK7, but the jre6 is still using in the market, and if i send my jar file to someone with jre6, it wont work, is there a way that application

6条回答
  •  旧时难觅i
    2020-12-19 02:03

    static public void main(String[] arg) throws IOException
        {
            PrintStream out = System.out;
            Properties pro = System.getProperties();
            Set set = pro.entrySet();
    
           Iterator> itr = set.iterator();
            while(itr.hasNext())
            {
                Map.Entry ent = itr.next();
                out.println(ent.getKey() + " -> " + ent.getValue() + "\n");
            }
    }
    

    Use System.getProperty("java.version") or System.getProperty("java.runtime.version") to get installed version of java.
    The above code snipped helps you find out more details such as java vendor name , OS etc.

提交回复
热议问题