【问题标题】:install4j: How can I get the version of the currently executing launcher?install4j:如何获取当前正在执行的启动器的版本?
【发布时间】:2021-09-19 14:26:29
【问题描述】:

我目前的尝试是:

    File executionDir = new File("").getCanonicalFile();
    ApplicationInfo info = ApplicationRegistry.getApplicationInfoByDir(executionDir);
    return info.getVersion();

它有效,但我想知道是否有一种方法可以在不对当前工作目录做出任何假设的情况下获取信息?

【问题讨论】:

    标签: java install4j


    【解决方案1】:

    可以查询sys.version编译器变量:

    import com.install4j.api.launcher.Variables.Variables;
    
    try {
        String version = Variables.getCompilerVariable("sys.version");
    } catch (IOException e) {
        // TODO not running in installation
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-07
      • 2019-08-23
      • 2014-01-27
      • 2011-06-13
      • 2012-01-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多