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

Mike Percy commented on FLUME-1154:
-----------------------------------

lgtm, except I'd recommend changing the wording of the warning to "JAVA_HOME is 
not set"

Regards,
Mike
                
> flume-ng script should first try finding java from PATH and then try using 
> bigtop, instead of vice-versa
> --------------------------------------------------------------------------------------------------------
>
>                 Key: FLUME-1154
>                 URL: https://issues.apache.org/jira/browse/FLUME-1154
>             Project: Flume
>          Issue Type: Bug
>          Components: Shell
>    Affects Versions: v1.2.0
>            Reporter: Will McQueen
>            Assignee: Leslin (Hong Xiang Lin)
>             Fix For: v1.2.0
>
>         Attachments: FLUME-1154.patch, FLUME-1154_1.patch, FLUME-1154_2.patch
>
>
> Please see bin/flume-ng script, under the "#find java" section.
> It says:
> # find java
> if [ -z "${JAVA_HOME}" ] ; then
>   echo "Warning: JAVA_HOME not set!"
>   # Try to use Bigtop to autodetect JAVA_HOME if it's available
>   if [ -e /usr/libexec/bigtop-detect-javahome ]; then
>     . /usr/libexec/bigtop-detect-javahome
>   elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ]; then
>     . /usr/lib/bigtop-utils/bigtop-detect-javahome
>   else
>     JAVA_DEFAULT=`type -p java`
>     [ -n "$JAVA_DEFAULT" ] || error "Unable to find java executable. Is it in 
> your PATH?" 1
>     JAVA_HOME=$(cd $(dirname $JAVA_DEFAULT)/..; pwd)
>   fi
> fi
> [ -n "${JAVA_HOME}" ] || error "Unable to find a suitable JAVA_HOME" 1
> ...and this means that if bigtop-detect-javahome was unable to located a java 
> executable. This could happen if the user stores the JDK under his/her own 
> dir in something like /home/<user>/tools/jdk1.6.0_26. The user could have the 
> JDK bin dir in his/her path, but may not necessarily have set JAVA_HOME. If 
> there are no other JDK's available for bigtop-utils to detect, then the 
> current flume-ng script will fail with error saying "Unable to find a 
> suitable JAVA_HOME", even though the java executable was in the PATH.
> So, I recommend doing the "type -p java" check first, and if that results in 
> no match then try bigtop-detect-javahome.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to