2

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
James
  • 4,211
  • 1
  • 18
  • 34
Darksmilie
  • 193
  • 1
  • 11

2 Answers2

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.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • @jwatkins It was Eclipse PDE that added BREE in the first place. Removing it generates a 'no required execution environment' warning on the MANIFEST.MF – greg-449 Sep 29 '18 at 20:11
  • @jwatkins It still generates the 'no required execution environment' message with 'Require-Capability' in the MANIFEST.MF – greg-449 Sep 29 '18 at 20:19
  • @jwatkins 2018-09 with Java 11 patch. 'Require-Capability' is not shown in bold text which I believe means the PDE editor doesn't know about it. – greg-449 Sep 29 '18 at 20:27
  • @greg-449 Ok, I reproduced the warning... It can be ignored, but indeed, it is there. I have been using Required-Capability without any issue for at least two years in applications running in both Equinox and Felix, and have recently converted RCP applications from RCP 3.4 to 2018-09, and indeed had to replace BREE to Requided-Capability header. – James Sep 29 '18 at 21:12
  • @greg-449 Still, after some more research, I see that despite the fact that Equinox, Felix and Bnd all agree against BREE, P2 is not yet ready to dump that header, and PDE seems to see no issue in keeping it... So let me change strategy regarding this question... I'll retract most of my comments and votes for now. I think the question ought first to be resolved by the concerned development communities – James Sep 29 '18 at 21:24
  • Setting BREE to Java 9 cause compilation issues in some situations. Also, according to https://bugs.eclipse.org/bugs/show_bug.cgi?id=533731, Equinox no longer use the BREE header, but it appears that PDE and P2 still does, so it is unclear what is the most appropriate action at present. – James Sep 29 '18 at 21:27
1

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).

James
  • 4,211
  • 1
  • 18
  • 34
  • Shouldn't that be version=10.0 not 1.10 since it is JavaSE-10 not JavaSE-1.10? Testing here version=9.0 is accepted, but 10.0 fails in the same way as using BREE. – greg-449 Sep 30 '18 at 06:51