[ 
https://issues.apache.org/jira/browse/KARAF-4976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric de Boer updated KARAF-4976:
--------------------------------
    Attachment: java

I've attached the java wrapper sh script that FreeBSD uses to start Java, which 
also sets JAVA_HOME

This should be the relevant code
{code}
_JAVAVM_PORTSDIR=
        if [ -r /usr/share/mk/bsd.port.mk ]; then
            _JAVAVM_PORTSDIR=`"${_JAVAVM_MAKE}" -f /usr/share/mk/bsd.port.mk -V 
PORTSDIR 2>/dev/null`
        fi

        _JAVAVM_BSD_PORT_MK=
        if [ -n "${_JAVAVM_PORTSDIR}" -a -r 
"${_JAVAVM_PORTSDIR}/Mk/bsd.port.mk" ]; then
            _JAVAVM_BSD_PORT_MK="${_JAVAVM_PORTSDIR}/Mk/bsd.port.mk"
        fi

        # If bsd.port.mk was found, use that to determine the VM to use.
        if [ -n "${_JAVAVM_BSD_PORT_MK}" ]; then
            JAVA_HOME=`"${_JAVAVM_MAKE}" -f "${_JAVAVM_BSD_PORT_MK}" -V 
JAVA_HOME USE_JAVA=yes 2>/dev/null`
            if [ -n "${JAVA_HOME}" -a -f "${JAVA_HOME}/bin/${_JAVAVM_PROG}" ]; 
then
                _JAVAVM_PROG_PATH="${JAVA_HOME}/bin"
                return 0
            elif [ -n "${JAVA_HOME}" -a \
                   -f "${JAVA_HOME}/jre/bin/${_JAVAVM_PROG}" ]; then
                _JAVAVM_PROG_PATH="${JAVA_HOME}/jre/bin"
                return 0
            fi
        fi
{code}

> JAVA_HOME autodiscovery not working on FreeBSD
> ----------------------------------------------
>
>                 Key: KARAF-4976
>                 URL: https://issues.apache.org/jira/browse/KARAF-4976
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-os-integration
>         Environment: FreeBSD
>            Reporter: Eric de Boer
>            Priority: Minor
>         Attachments: java
>
>
> If JAVA_HOME isn't set setenv tries to detect it from the path of java. On 
> FreeBSD this is /usr/local/bin/java,  while java resides in 
> /usr/local/openjdk8/. This leads to setting JAVA_HOME to a non existing path
> It would be nice to have it autodetect correctly, but at least check if the 
> guessed JAVA_HOME  is really a JDK/JRE, so it can be set correctly manually.
> Currently Karaf starts ok, but some functions that rely on a correct setting 
> of JAVA_HOME fail with unrelated error messages (e.g. doing a https call only 
> throws a premaster secret key error, because the Java ext dir is set 
> incorrectly)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to