I have using Eclipse Luna win32.x86_64 runing with Java 8.
Here from the Help Menu > About > Installation Detail > Configuration Tab
:
java.runtime.version=1.8.0_05-b13 java.version=1.8.0_05
I have created new plug-in project, requesting JavaSE-1.8
as Execution Environment:
In the myplugin/META-INF/MANIFEST.MF
file I have of course:
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
I use this plugin in a product file. When I try to validate it, I get following error:
Of course if I start the product, I get:
!ENTRY org.eclipse.osgi 2 0 2014-07-10 08:14:22.042 !MESSAGE One or more bundles are not resolved because the following root constraints are not resolved: !SUBENTRY 1 org.eclipse.osgi 2 0 2014-07-10 08:14:22.043 !MESSAGE Bundle update@********/myplugin/ was not resolved. !SUBENTRY 2 myplugin 2 0 2014-07-10 08:14:22.044 !MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8))".
I have tried to verify a lot:
Preferences > Java > Installed JREs
Preferences > Java > Installed JREs > Excution Environments
Preferences > Java > Compiler: JDK Compliance Compiler compliance level
When I start the product, I checked in the Launching tab that I use the jre8 as execution environment.
I have even tried to change the Java Runtime Environment
in the Run Configurations
Dialog:
I have tried different settings. None of them works.
What is wrong?
Is it a known issue?
Java 8 is a revolutionary release of the world's #1 development platform. It includes a huge upgrade to the Java programming model and a coordinated evolution of the JVM, Java language, and libraries.
It's important to note that even in 2022, many applications continue to run on Java 8 and Java 11. While Java 17 offers LTS, it's certainly not unusual if your application is using 11 or even 8. In 2022, the majority of applications are using Java 8+.
There are several reasons why one should upgrade from Java 8 to Java 11. Applications written in Java 9, 10, and 11 are significantly faster and more secure than previous versions of the language. ZGC and Epsilon garbage collectors have improved Garbage Collection.
The error means that your bundle has a Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8))"
entry in its manifest. So this means the bundle will only start when there is a bundle that provides this capability.
In case of the osgi.ee capability it is the OSGi framework (equinox) that should provide this capability. Apparently it does not do this.
So one approach would be to remove the header from you bundle Manifest. The other would be to make equinox export the capability. Perhaps you could simply try with the newest equinox version. Not sure if this helps though. You could also try to set the framework property (using -D): org.osgi.framework.system.capabilities=osgi.ee; osgi.ee="JavaSE";version:List="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8"
See
Sharing my experience on retrofitting a target platform based on Juno 3.8.2 to run JUnit plugin tests with Bundle-RequiredExecutionEnvironment
("BREE") JavaSE-1.8
:
Creating a fragment to org.eclipse.osgi
with a Provide-Capability
header in the manifest:
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: FrwJava8Support Bundle-SymbolicName: frwJava8Support Bundle-Version: 1.0.0.qualifier Fragment-Host: org.eclipse.osgi;bundle-version="3.8.2" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Provide-Capability: osgi.ee;osgi.ee="JavaSE";version:List="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8"
This capability was never picked up.
Using -Dorg.osgi.framework.system.capabilities
as outlined in Christian's answer.
First of all, the argument must be quoted correctly:
-Dorg.osgi.framework.system.capabilities="osgi.ee; osgi.ee=\"JavaSE\";version:List=\"1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8\""
This approach might have worked for any other use case other than pde.junit
. I still got this (slightly different) exception:
!MESSAGE Bundle com.XXX.tst.frw.common_1.0.0.qualifier [92] was not resolved. !SUBENTRY 2 com.XXX.tst.frw.common 2 0 2015-04-18 13:43:55.336 !MESSAGE Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.8 !SUBENTRY 1 org.eclipse.osgi 2 0 2015-04-18 13:43:55.336 !MESSAGE Bundle com.XXX.tst.frw.common.test_1.0.0.qualifier [101] was not resolved. !SUBENTRY 2 com.XXX.tst.frw.common.test 2 0 2015-04-18 13:43:55.336 !MESSAGE Missing host com.XXX.tst.frw.common_1.0.0. !ENTRY org.eclipse.osgi 4 0 2015-04-18 13:43:55.336 !MESSAGE Application error !STACK 1 java.lang.IllegalArgumentException: Bundle "com.XXX.tst.frw.common" not found. Possible causes include missing dependencies, too restrictive version ranges, or a non-matching required execution environment. at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.getClassLoader(RemotePluginTestRunner.java:77)
Patch the org.eclipse.osgi
bundle to include Luna's JavaSE-1.8.profile
.
Copy file <LUNA>\plugins\org.eclipse.osgi_3.10.1.v20140909-1633.jar\JavaSE-1.8.profile
to your target platform bundle pool's org.eclipse.osgi
bundle.
(e.g. <myworkspace>\.metadata\.plugins\org.eclipse.pde.core\.bundle_pool\plugins\org.eclipse.osgi_3.8.2.v20130124-134944.jar\JavaSE-1.8.profile
)
Reference profile in profile.list
(actually, this seems to be optional):
add JavaSE-1.8.profile,\
to .metadata\.plugins\org.eclipse.pde.core\.bundle_pool\plugins\org.eclipse.osgi_3.8.2.v20130124-134944.jar\profile.list
However, this solution requires hosting your own P2 repository containing the org.eclipse.osgi
bundle or applying a patch to every workspace's bundle pool.
Still, there exists the possibility to keep BREE at "JavaSE-1.7" that is compatible with the existing org.eclipse.osgi
3.8.2 version.
I am currently aware of two drawbacks:
Presumably, PDE evaluates BREE and sets compiler source level accordingly which then results in "1.7" for Java 8 sources. It is possible that other PDE features (feature export, product export) might exhibit same problem.
Using Eclipse Tycho, it is possible to manually override the javac source level instead of evaluating a bundle's BREE (to select a JDK to compile with). However, also Tycho still matches the given source level vs. BREE and refuses to compile Java 8 code (tested with Tycho 0.22).
Also, approach 2 will most likely not work with PDE's bundle export, at least I am not aware of any possibility to pass VM arguments.
We went with approach 3 and successfully patched our target platform to use Java 8 together with Eclipse 3.8.
As we already maintain our own P2 repository with all 3.8-based Eclipse plugins, we needed to:
org.eclipse.osgi
(needed to strip signing information from bundle as well)org.eclipse.rcp
feature with updated org.eclipse.osgi
bundleIf you maintain your own P2 repository to serve a custom target platform instead of using any Eclipse.org-based update site, it is possible to make Eclipse 3.8 work with Java 8.
References: Eclipse Bug to support osgi.ee
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With