Friday, July 10, 2009

Force JAVA_HOME during Sun Communications Express configuration

I was with my American bank customer yesterday trying to install and configure a new instance of Sun Messaging Server 7.0 u2.



Simple architecture - single instance, no high-availability, no failover capability. (Ask them why? No budget was the answer. :> )

Anyway, they have this special requirement:

  • All components to be installed in a dedicated directory /sjsms
  • All components to utilize JDK from a special directory /sjsms/jdk, not the default /usr/jdk in Solaris
Fine, I have no issue. Isn't setting JAVA_HOME=/sjsms/jdk and export the variable into the installation environment will do?

All went fine, except when we tried to configure UWC (Sun Communications Express). Very strange, "configure-uwc" was not able to pick up the JAVA_HOME variable.

A look into the script reveals:


## Look for a Java Runtime Environment#
if [ -x ${INSTALLDIR}/bin/base/jre/bin/java ]; then
JAVA_HOME=${INSTALLDIR}/bin/base/jre
export JAVA_HOME
## Our private copy of java
elif [ -x /usr/jdk/entsys-j2se/bin/java ]; then
JAVA_HOME=/usr/jdk/entsys-j2se
export JAVA_HOME
## Standard Orion location
elif [ -x /usr/j2se/bin/java ]; then
JAVA_HOME=/usr/j2se
export JAVA_HOME
## Standard java location
elif [ ${JAVA_HOME} ]; then
## honor JAVA_HOME variable
:
else
## No Java was found. Execute the default java
## command to produce a meaningfull L10N message
## and then exit.
/usr/j2se/bin/java
exit 1
fi


Shouldn't the JAVA_HOME variable be consulted first? If it exists, the if-the-else condition should terminate immediately. Weird logic.

Anyway, we change the script to suit the bank's requirement.

No comments:

Post a Comment