eclipse tycho + java 11 = Unknown OSGi execution environment: 'JavaSE-11'
Asked Answered
Z

2

6

How to build an eclipse RCP app based on Java 11 with tycho?
I'm using eclipse 2018-09 RCP + the Java 11 plugin + OpenJDK 11
My application is plugin-based and in all the plugins, theMANIFEST.MFfile contains:

Bundle-RequiredExecutionEnvironment: JavaSE-11

The tycho build fails with the following exception:

    [ERROR] Internal error: org.eclipse.tycho.core.osgitools.OsgiManifestParserException: Exception parsing OSGi MANIFEST {...}\META-INF\MANIFEST.MF: Unknown OSGi execution environment: 'JavaSE-11' -> [Help 1]
    org.apache.maven.InternalErrorException: Internal error: org.eclipse.tycho.core.osgitools.OsgiManifestParserException: Exception parsing OSGi MANIFEST {...}\META-INF\MANIFEST.MF: Unknown OSGi execution environment: 'JavaSE-11'
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:120)
    {...}
    Caused by: org.eclipse.tycho.core.ee.UnknownEnvironmentException: Unknown OSGi execution environment: 'JavaSE-11'
        at org.eclipse.tycho.core.ee.ExecutionEnvironmentUtils.getExecutionEnvironment(ExecutionEnvironmentUtils.java:84)
        at org.eclipse.tycho.core.osgitools.OsgiManifest.parseExecutionEnvironments(OsgiManifest.java:66)
        ... 24 more

Is tycho compatible with Java 11? if so how to configure it to build java 11 RCP apps?

I found this post that is very similar (for Java 10...)

Zadazadack answered 2/10, 2018 at 12:0 Comment(3)
I think OSGi support for Java 11 will be provided by Eclipse 4.10 (2018-12)Tempietempla
OK... it seems that it is the same as currently when you use the Java 11 plugin (which I do). Very uncertain about the difference and the big question remains. Will tycho support Java 11? When ?Zadazadack
See Eclipse bug 532302Opia
Z
3

Using eclipse RCP v2018-12 (v4.10) + eclipse tycho v1.3.0 solved all my problems
JMSToolBox is now developped and distributed with Java 11
(see also this post for packaging Java 11 JRE)

Zadazadack answered 5/1, 2019 at 15:47 Comment(0)
M
-2

This means your Maven is not using Java 11 for compilation

look somewhere in you Maven POM files. it might be very likely that you have constrained your maven build to another version than Java 11. Most likely you will find it in your parent POM file. It may be that you set at least one of the properties maven.compiler.target or maven.compiler.source to something like:

<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>

set them to

<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>

also be shure your Maven runs on Java 11 bu entering:

mvn --version

in your command line. Maven then should print:

$ mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\xxxxxxx\APPs\apache-maven-3.6.3
Java version: 11.0.8, vendor: AdoptOpenJDK, runtime: C:\Program Files\AdoptOpenJDK\jdk-11.0.8.10-hotspot
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

If this doesn't help and it fails during target resolution, check further in your tycho settings if you find the tag <executionEnvironment> check if it says something like JavaSE-11 it may also be, that your build bundles a JRE. Then you may point to this JRE like:

<executionEnvironment>org.eclipse.justj.openjdk.hotspot.jre.full-11</executionEnvironment>
Modigliani answered 17/11, 2022 at 9:7 Comment(1)
You re giving a wrong answer to this 4 years old question that was flagged as a bug in tycho. It works as designed since tycho v1.3 which is 3 years old now...Zadazadack

© 2022 - 2024 — McMap. All rights reserved.