使用C,C ++或Java以编程方式获取Java和Flash的版本号 [英] Programmatically getting Version number of Java and Flash using C, C++, or Java

查看:126
本文介绍了使用C,C ++或Java以编程方式获取Java和Flash的版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到计算机上安装的当前版本的Java的版本号以及在任何给定的具有闪存的网页浏览器上安装的当前版本的Flash。有没有办法使用Java,C或C ++来做到这一点?如果是这样,我应该看什么类/库?

解决方案

如果您在Java中

  System.out.println(System.getProperty(java.version)); 
System.out.println(System.getProperty(java.vendor));
System.out.println(System.getProperty(java.vm.name));

输出

  1.7.0_03 
Oracle Corporation
Java HotSpot™客户端VM



(Map.Entry e:System.getProperties()。entrySet())有更多关于Java的道具


  (((String)e.getKey())。startsWith(java)){
System.out.println(e);


code








$ b

  java.runtime.name = Java™SE运行时环境
java.vm.version = 22.1-b02
java.vm.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vm.name = Java HotSpot(TM)客户端VM
java.vm.specification.name = Java虚拟机规范
java.runtime.version = 1.7.0_03-b05
....

至于其他语言,我认为你可以通过从应用程序运行%JAVA_HOME%/ java -version 来完成,读取输出结果

  java version1.7.0_03
Java™SE运行环境(build 1.7.0_03-b05)
Java HotSpot(TM)客户端虚拟机(构建22.1-b02,混合模式,共享)

对上面的JavaProps应用程序,运行它作为%JAVA_HOME%/ java JavaProps 并读取输出


I want to find the version number of the current version of Java installed on the computer and the current version of Flash installed on any given web browser that has flash. Is there a way to do this using Java, C, or C++? If so, what class/library should I look into?

解决方案

If you are in Java

    System.out.println(System.getProperty("java.version"));
    System.out.println(System.getProperty("java.vendor"));
    System.out.println(System.getProperty("java.vm.name"));

output

1.7.0_03
Oracle Corporation
Java HotSpot(TM) Client VM

there are more props about Java

    for(Map.Entry e  : System.getProperties().entrySet()) {
        if (((String)e.getKey()).startsWith("java")) {
            System.out.println(e);
        }
    }

.

java.runtime.name=Java(TM) SE Runtime Environment
java.vm.version=22.1-b02
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
java.vm.name=Java HotSpot(TM) Client VM
java.vm.specification.name=Java Virtual Machine Specification
java.runtime.version=1.7.0_03-b05
....

As for other languages I think you can do it by running %JAVA_HOME%/java -version from your app, reading the output

java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode, sharing)

Or you can right a JavaProps app like the above, run it as %JAVA_HOME%/java JavaProps and read the output

这篇关于使用C,C ++或Java以编程方式获取Java和Flash的版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆