【问题标题】:Finding the Eclipse Version Number查找 Eclipse 版本号
【发布时间】:2011-02-05 23:40:40
【问题描述】:

我已经发布了如何在 Eclipse Gallileo 中找到它,但如果有人有旧版本的信息,请随时在下面发布。

【问题讨论】:

  • 点击here检查该链接。你会得到更好的答案

标签: eclipse version


【解决方案1】:

如果您使用的是 mac,那么关于 Eclipse 可以在顶部的 Eclipse 选项中使用。

【讨论】:

    【解决方案2】:

    1 - 打开 Eclipse IDE。 2 - 按:Alt + H 3 - 使用键盘箭头向下列表 4 - 选择关于 Eclipse IDE 选项卡。

    【讨论】:

      【解决方案3】:

      基于Neeme Praks'answer,下面的代码应该为您提供您正在运行的eclipse ide版本。

      在我的例子中,我运行的是 Eclipse 衍生产品,所以 Neeme 的回答只是给了我该产品的版本。 OP 询问如何找到 Eclipse 版本,这就是我所追求的。因此,我需要进行一些更改,导致我这样做:

          /**
           * Attempts to get the version of the eclipse ide we're running in.
           * @return the version, or null if it couldn't be detected.
           */
          static Version getEclipseVersion() {
              String product = "org.eclipse.platform.ide";
              IExtensionRegistry registry = Platform.getExtensionRegistry();
              IExtensionPoint point = registry.getExtensionPoint("org.eclipse.core.runtime.products");
              if (point != null) {
                  IExtension[] extensions = point.getExtensions();
                  for (IExtension ext : extensions) {
                      if (product.equals(ext.getUniqueIdentifier())) {
                          IContributor contributor = ext.getContributor();
                          if (contributor != null) {
                              Bundle bundle = Platform.getBundle(contributor.getName());
                              if (bundle != null) {
                                  return bundle.getVersion();
                              }
                          }
                      }
                  }
              }
              return null;
          }
      

      这将为您返回一个方便的Version,可以这样比较:

          private static final Version DESIRED_MINIMUM_VERSION = new Version("4.9"); //other constructors are available
          boolean haveAtLeastMinimumDesiredVersion()
              Version thisVersion = getEclipseVersion();
              if (thisVersion == null) {
                  //we might have a problem
              }
              //returns a positive number if thisVersion is greater than the given parameter (desiredVersion)
              return thisVersion.compareTo(DESIRED_MINIMUM_VERSION) >= 0;
          }
      

      【讨论】:

        【解决方案4】:

        这是一个工作代码 sn-p,它将打印出当前运行的 Eclipse(或任何基于 RCP 的应用程序)的完整版本。

        String product = System.getProperty("eclipse.product");
        IExtensionRegistry registry = Platform.getExtensionRegistry();
        IExtensionPoint point = registry.getExtensionPoint("org.eclipse.core.runtime.products");
        Logger log = LoggerFactory.getLogger(getClass());
        if (point != null) {
          IExtension[] extensions = point.getExtensions();
          for (IExtension ext : extensions) {
            if (product.equals(ext.getUniqueIdentifier())) {
              IContributor contributor = ext.getContributor();
              if (contributor != null) {
                Bundle bundle = Platform.getBundle(contributor.getName());
                if (bundle != null) {
                  System.out.println("bundle version: " + bundle.getVersion());
                }
              }
            }
          }
        }
        

        它查找当前运行的“产品”扩展并获取贡献插件的版本。

        在 Eclipse Luna 4.4.0 上,它给出了正确的4.4.0.20140612-0500 的结果。

        【讨论】:

          【解决方案5】:

          有一个系统属性 eclipse.buildId(例如,对于 Eclipse Luna,我有 4.4.1.M20140925-0400 作为值)。 p>

          我不确定这个属性在哪个版本的 Eclipse 中可用。

          另外,深入探索所有可用的系统属性——在 eclipse.*、os.* osgi.* 和 org.osgi.* 命名空间下有相当多的可用信息。


          更新! 在尝试了不同的 Eclipse 版本之后,似乎eclipse.buildId 系统属性不是要走的路。例如,在 Eclipse Luna 4.4.0 上,它给出了4.4.2.M20150204-1700 的结果,这显然是不正确的。

          我怀疑eclipse.buildId 系统属性设置为org.eclipse.platform 插件的版本。不幸的是,这并不(总是)给出正确的结果。但是,好消息是我有一个带有工作代码示例的解决方案,我将在单独的答案中概述。

          【讨论】:

            【解决方案6】:

            (2012 年 9 月更新):

            MRT 指出in the comments 的“Eclipse Version”问题引用了主文件夹中的.eclipseproduct,它包含:

            name=Eclipse Platform
            id=org.eclipse.platform
            version=3.x.0
            

            所以这似乎比我下面的原始答案更简单。

            另外,Neeme Praks 提到 below 有一个 eclipse/configuration/config.ini,其中包括如下一行:

            eclipse.buildId=4.4.1.M20140925-0400
            

            再一次更容易找到,因为这些是使用System.getProperty("eclipse.buildId") 设置和找到的 Java 属性。


            原始答案(2009 年 4 月)

            对于 Eclipse Helios 3.6,您可以直接从 About 屏幕推断 Eclipse Platform 版本:
            它是 Eclipse 全局版本和构建 ID 的组合:

            以下是 Eclipse 3.6M6 的示例:
            版本将是:3.6.0.v201003121448,在版本 3.6.0 和构建 ID I20100312-1448 之后(2010 年 3 月 12 日 14h48 的集成构建

            要更容易查看,请单击“插件详细信息”并按版本排序。


            注意:Eclipse3.6 有一个全新的炫酷标志:

            您可以看到现在在不同插件的加载步骤中显示的构建 ID。

            【讨论】:

            【解决方案7】:

            对于 Eclipse Kepler,没有帮助 > 关于 Eclipse,但我发现这是可行的:

            Eclipse > 关于 Eclipse

            【讨论】:

            • “Eclipse”是什么意思。我在“文件编辑导航...”行中没有看到此选项。
            • 我在 Mac 上,所以有一个名为 Eclipse 的菜单选项位于名为 File 的菜单选项的左侧。
            【解决方案8】:

            我认为,最简单的方法是在路径 eclipse/readme/eclipse_readme 的 Eclipse 目录中读取 readme 文件。

            在此文件的最顶部,它清楚地说明了版本号:

            对于我的 Eclipse Juno;它说版本为Release 4.2.0

            【讨论】:

              【解决方案9】:

              对于 Eclipse Java EE IDE - Indigo: 帮助 > 关于 Eclipse > Eclipse.org(倒数第三个)。在“关于 Eclipse 平台”中找到 Eclipse 平台,您将在版本列下方看到版本。希望这对 J2EE Indigo 用户有所帮助。

              【讨论】:

                【解决方案10】:

                如果你想以编程方式访问它,你可以通过确定 eclipse\plugins\org.eclipse.platform_plugin 的版本来实现

                    String platformFile = <the above file>; //actually directory
                
                versionPattern = Pattern.compile("\\d\\.\\d\\.\\d");
                Matcher m = versionPattern.matcher(platformFile);
                return m.group();
                

                【讨论】:

                  【解决方案11】:

                  在 Eclipse Gallileo 中:

                  关于页面(Help -> About Eclipse)在对话框底部有一些图标。这应该包括两个普通的 Eclipse 图标。选择带有工具提示“Eclipse.org”的那个。 Eclipse 有很多组件,每个组件都有自己的版本号。核心是Eclipse平台

                  【讨论】:

                    猜你喜欢
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 2014-08-15
                    • 1970-01-01
                    • 1970-01-01
                    • 2018-02-23
                    • 1970-01-01
                    相关资源
                    最近更新 更多