Bug 788704 - rhq-agent startup: Have set_java_home() to find recent JDKs
Summary: rhq-agent startup: Have set_java_home() to find recent JDKs
Keywords:
Status: NEW
Alias: None
Product: RHQ Project
Classification: Other
Component: Launch Scripts
Version: 4.3
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: ---
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-08 20:38 UTC by Elias Ross
Modified: 2022-03-31 04:28 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Elias Ross 2012-02-08 20:38:38 UTC
Trying to figure out why tools.jar is not being found...This is important for the new JMX plugin.

The key is realizing /usr/bin/java is a symbolic link, on Linux and Mac OS.

Should be:

diff --git a/rhq-agent/bin/rhq-agent.sh b/rhq-agent/bin/rhq-agent.sh
index 19a0ae6..92e5ba5 100755
--- a/rhq-agent/bin/rhq-agent.sh
+++ b/rhq-agent/bin/rhq-agent.sh
@@ -39,6 +39,9 @@ set_java_home ()
 {
    if [ "x$JAVA_HOME" = "x" ]; then
       _WHICH_JAVA=`which java 2>/dev/null`
+      if [ -L $_WHICH_JAVA ]; then
+         _WHICH_JAVA=`readlink $_WHICH_JAVA`
+      fi
       if [ "x$_WHICH_JAVA" != "x" ]; then
          _WHICH_JAVA_BIN_DIR=`dirname "$_WHICH_JAVA"`
          JAVA_HOME=`dirname "$_WHICH_JAVA_BIN_DIR"`
@@ -47,7 +50,7 @@ set_java_home ()
          JAVA_HOME=/usr
          debug_msg "Running on Mac OS X, setting JAVA_HOME to ${JAVA_HOME}"
       elif [ "x$_LINUX" != "x" ]; then
-         JAVA_HOME=/usr/lib/jvm/jre
+         JAVA_HOME=/usr/java/default
          debug_msg "Running on Linux, setting JAVA_HOME to ${JAVA_HOME}"
       fi
    fi


It seems that on Linux JAVA_HOME of /usr/lib/jvm/jre is not applicable.

If you list the files for jdk-1.6.0_30-fcs (as an example):

rpm --query --filesbypkg jdk

everything is under /usr/java/X now.

JAVA_HOME should be set to either /usr/java/jdk1.6.0_30 or /usr/java/latest by default there.

there are no files in /usr/lib anymore.

JAVA_HOME should be /System/Library/Frameworks/JavaVM.framework/Versions/Current/ on Mac OS, probably. You will need to play around with getting tools.jar found there...

Comment 1 Mike Foley 2012-02-13 16:59:28 UTC
per triage 2/13/2012 (asantos, crouch, foley, loleary)


Note You need to log in before you can comment on or make changes to this bug.