You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2018/02/17 16:09:00 UTC

[jira] [Commented] (KARAF-5611) karaf.bat still uses endorsed dirs with Java 9 install

    [ https://issues.apache.org/jira/browse/KARAF-5611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16368258#comment-16368258 ] 

Jean-Baptiste Onofré commented on KARAF-5611:
---------------------------------------------

{{karaf.bat}} should detect the Java version using:

{code}
for /f tokens^=2-5^ delims^=.-_^" %%j in ('"%JAVA%" -fullversion 2^>^&1') do set "JAVA_VERSION=%%k%"
{code}

Then, it checks if it's GTR 8 and doesn't use endorsed:

{code}
        for /f tokens^=2-5^ delims^=.-_^" %%j in ('"%JAVA%" -fullversion 2^>^&1') do set "JAVA_VERSION=%%k%"
        if "%JAVA_VERSION%" GTR 8 (
            "%JAVA%" %JAVA_OPTS% %OPTS% ^
                --add-opens java.base/java.security=ALL-UNNAMED ^
                --add-opens java.base/java.net=ALL-UNNAMED ^
                --add-opens java.base/java.lang=ALL-UNNAMED ^
                --add-opens java.base/java.util=ALL-UNNAMED ^
                --add-opens java.naming/javax.naming.spi=ALL-UNNAMED ^
                --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED ^
                --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED ^
                --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED ^
                --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED ^
                --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED ^
                --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED ^
                --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED ^
                --add-modules java.xml.ws.annotation,java.corba,java.transaction,java.xml.bind,java.xml.ws ^
                -classpath "%CLASSPATH%" ^
                -Dkaraf.instances="%KARAF_HOME%\instances" ^
                -Dkaraf.home="%KARAF_HOME%" ^
                -Dkaraf.base="%KARAF_BASE%" ^
                -Dkaraf.etc="%KARAF_ETC%" ^
                -Dkaraf.restart.jvm.supported=true ^
                -Djava.io.tmpdir="%KARAF_DATA%\tmp" ^
                -Dkaraf.data="%KARAF_DATA%" ^
                -Djava.util.logging.config.file="%KARAF_BASE%\etc\java.util.logging.properties" ^
                %KARAF_SYSTEM_OPTS% %KARAF_OPTS% %MAIN% %ARGS%
        ) 
{code}

So, let me try on a VM as it should already work.

> karaf.bat still uses endorsed dirs with Java 9 install
> ------------------------------------------------------
>
>                 Key: KARAF-5611
>                 URL: https://issues.apache.org/jira/browse/KARAF-5611
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 4.2.0.M2
>         Environment: Running on Windows 10 Enterprise v 1703
> java version "9.0.4"
> Java(TM) SE Runtime Environment (build 9.0.4+11)
> Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
>            Reporter: David Otasek
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>             Fix For: 4.2.0
>
>
> karaf.bat does appear to recognise my Java 9, and still attempts to execute with endorsed dirs, resulting in this error message:
> {quote}-Djava.endorsed.dirs=C:\Program Files\Java\jre-9.0.4\jre\lib\endorsed;C:\Program Files\Java\jre-9.0.4\lib\endorsed;C:\Users\D Otasek\Desktop\cytoscape-windows-3.7.0-SNAPSHOT\framework\bin\..\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.{quote}



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