You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Shahin Mameghani (JIRA)" <ji...@apache.org> on 2018/04/11 07:59:00 UTC

[jira] [Created] (KARAF-5695) Starting Karaf 4.2.0 on Ubuntu 17.10 with OpenJDK 9 fails

Shahin Mameghani created KARAF-5695:
---------------------------------------

             Summary: Starting Karaf 4.2.0 on Ubuntu 17.10 with OpenJDK 9 fails
                 Key: KARAF-5695
                 URL: https://issues.apache.org/jira/browse/KARAF-5695
             Project: Karaf
          Issue Type: Bug
    Affects Versions: 4.2.0
         Environment: Ubuntu 17.10
OpenJDK 9 (build 9-Ubuntu+0-9b181-4)
            Reporter: Shahin Mameghani


In earlier versions of Java, executing {{java -version}} in a terminal will return for instance {{1.8.0_162}} but in Ubuntu with Java 9 it returns {{9-Ubuntu}}. Because of this, when executing {{./bin/karaf}}, the following error output is given.
{code:java}
/home/shahin/tools/apache-karaf-4.2.0/bin/karaf: 212: [: Illegal number: 9-Ubuntu
/home/shahin/tools/apache-karaf-4.2.0/bin/karaf: 274: [: Illegal number: 9-Ubuntu
-Djava.endorsed.dirs=/usr/lib/jvm/java-9-openjdk-amd64/jre/lib/endorsed:/usr/lib/jvm/java-9-openjdk-amd64/lib/endorsed:/home/shahin/tools/apache-karaf-4.2.0/lib/endorsed is not supported. Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
{code}
Starting Karaf with Java 8 works fine.

A workaround for this was to modify the {{sed}} expression at line 211 in the function {{checkJvmVersion()}} in {{./bin/inc}} from
{code:java}
sed -e 's/_.*//g; s/^1\.//g ; s/\..*//g;'{code}
to
{code:java}
sed -e 's/_.*//g; s/^1\.//g ; s/\..*//g; s/-.*//g;'
{code}
After this Karaf boots properly with Java 9.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)