Details
-
Type: Improvement
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: CDH5.0.0
-
Fix Version/s: None
-
Component/s: Packaging
-
Labels:
-
Environment:CentOS 6.5 or any Red Hat based distro
CDH5
Description
Although JAVA_HOME is set as an environmental var, when starting any process as a service, almost all environmental variables are dropped and the application is required to define JAVA_HOME.
I found that CDH uses the script /usr/lib/bigtop-utils/bigtop-detect-javahome to determine which version of java to use. While this works if a user has multiple version of Java installed, bigtop-detect-javahome will prefer java 6 over java 7 and java 7 over java 8. The only way for a user to configure which java to use is to hardcode JAVA_HOME into /usr/lib/bigtop-utils/bigtop-detect-javahome. This is not elegant.
I propose that bigtop-detect-javahome read from the file /etc/default/java_home to determine the $JAVA_HOME. This is an elegant solution that allows users to define JAVA_HOME and have it used in all CDH supported software.
The only line of code needed to be added to bigtop-detect-javahome is:
[ -f /etc/default/java_home ] && . /etc/default/java_home
The user can than choose to define JAVA_HOME in /etc/default/java_home or they can allow bigtop-detect-javahome to detect it for them.