问题
I moved my RCP application from Eclipse Oxygen to Photon, and also from Java 8 to Java 10.
The code compiles and the application works fine if I start it from Eclipse. However, when I try to build my application, I get an error:
plug-in JavaSE_0.0.0 has not been found
Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-10
Host plug-in JavaSE_0.0.0 has not been found.
I can't find any useful solution on Google. Maybe some of you can help me.
My manifest file contains this header:
Bundle-RequiredExecutionEnvironment: JavaSE-10
回答1:
This seems to be an Eclipse bug. Eclipse seems not to able to deal with JavaSE-10 properly.
The simplest solution at the moment is just to use Bundle-RequiredExecutionEnvironment: JavaSE-9
rather than JavaSE-10 and put up with the warning that this doesn't match the JRE container.
回答2:
Since OSGi 4.3, the most appropriate way to specify a minimum Java version is using the Required-Capability header, as in:
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=1.10))"
I have had success fixing the reported error by replacing all occurrences of Bundle-RequiredExecutionEnvironment
with the above line. In PDE, you may get a warning on the manifest file, but it can be safely ignored. Product validation and product exports seems to work without issue. One thing I'm not sure however is how P2 reacts when fed bundles that do not contains the BREE header.
Alternatively, Eclipse 2018-09 is now out, and seems to provide a JavaSE-10 environment description (just in time for JavaSE 10 deprecation...); I haven't tested yet JavaSE 11 support (available as a plugin for Eclipse 2018-09).
来源:https://stackoverflow.com/questions/51247561/host-plug-in-javase-has-not-been-found-in-rcp-application-with-java-10