如何在 Eclipse 插件中使用 Java11(Java10)? [英] How to use Java11 (Java10) with Eclipse Plugin?

查看:35
本文介绍了如何在 Eclipse 插件中使用 Java11(Java10)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在我的 Eclipse 插件中指定 JavaSE-10 作为最小执行环境:

将插件作为 Eclipse 应用程序启动时出现以下错误:

org.osgi.framework.BundleException:无法解析模块:org.treez.core [597]未解决的需求:Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=10))"未解决的需求:Require-Bundle: org.treez.javafxd3;可见性:=再出口"->捆绑符号名称:org.treez.javafxd3;捆绑版本="1.0.0.qualifier";单例:=真"org.treez.javafxd3 [586]未解决的需求:Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=10))"在 org.eclipse.osgi.container.Module.start(Module.java:444)在 org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)在 org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)在 org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)在 org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)在 org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)在 org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)在 org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

我查过了

  • Java10 在已安装的 JRE 下备受推崇
  • 10 被选为合规级别

我使用 Oxygen.3a Release (4.7.3a) Build id: 20180405-1200

=>这是 Eclipse Equinox 中的错误吗?

=>我还可以检查什么来解决这个问题?

如果我从最低执行环境设置中删除 JavaSE-10,我就能够启动 Eclipse 应用程序并且插件似乎工作正常.

当我导出插件时,我收到以下警告:

# 25.04.18, 12:25:40 MESZ# Eclipse Compiler for Java(TM) v20180330-0919, 3.13.102, 版权所有 IBM Corp 2000, 2015.保留所有权利.合规级别 9 及以上不支持选项 -bootclasspath

当我从我的更新页面安装插件后尝试使用它时,我得到一个 ClassNotFoundException:

<代码>...原因:java.lang.ClassNotFoundException: org.treez.views.views_1.0.0.201804191641 找不到 org.treez.views.tree.TreeViewPart在 org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)在 org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)在 org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)在 org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)在 java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)在 org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564)在 org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)... 114 更多

如果我使用 Java8,一切正常.

相关问题:

  • (因此,如果未应用该选项,我假设在导出向导的编译步骤中出现问题.)

    我使用 Java 11.0.1 和 Eclipse SimRel 2018-09(加上 Java11 支持插件)

    If I specify JavaSE-10 as minimum execution environment in my Eclipse plugin:

    I get following errors when starting my plugin as Eclipse Application:

    org.osgi.framework.BundleException: Could not resolve module: org.treez.core [597]
      Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
      Unresolved requirement: Require-Bundle: org.treez.javafxd3; visibility:="reexport"
        -> Bundle-SymbolicName: org.treez.javafxd3; bundle-version="1.0.0.qualifier"; singleton:="true"
           org.treez.javafxd3 [586]
             Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
    
        at org.eclipse.osgi.container.Module.start(Module.java:444)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
    

    I checked that

    • Java10 is reverenced under Installed JREs
    • 10 is selected as compliance level

    I use Oxygen.3a Release (4.7.3a) Build id: 20180405-1200

    =>Is this a bug in eclipse equinox?

    =>What else can I check to resolve this issue?

    If I remove JavaSE-10 from the minimum execution environment settings I am able to start the Eclipse Application and the plugin seems to work fine.

    When I export the plugin I get following warning:

    # 25.04.18, 12:25:40 MESZ
    # Eclipse Compiler for Java(TM) v20180330-0919, 3.13.102, Copyright IBM Corp 2000, 2015. All rights reserved.
    option -bootclasspath not supported at compliance level 9 and above
    

    When I try to use the plugin after installing it from my update page, I get a ClassNotFoundException:

    ...
    Caused by: java.lang.ClassNotFoundException: org.treez.views.tree.TreeViewPart cannot be found by org.treez.views_1.0.0.201804191641
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564)
        at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
        ... 114 more
    

    If I use Java8 everything works fine.

    Related questions:

    解决方案

    What worked for me as a work around was to

    • Remove the required version entries from the manifest files and ignore the corresponding warnings

    • Activate the option "Use class files compiled in the workspace" in the export wizard:

    (Therefore I assume that something goes wrong during the compilation step of the export wizard if that option is not applied.)

    I used Java 11.0.1 and Eclipse SimRel 2018-09 (plus Java11 support plugin)

    这篇关于如何在 Eclipse 插件中使用 Java11(Java10)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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