On AIX, gradle fails to find Java despite good JAVA_HOME

On AIX, I have correctly set JAVA_HOME to /usr/java7_64/jre/bin. But when I type:
gradle -v

I get this error message:
ERROR: JAVA_HOME is set to an invalid directory: /usr/java7_64/jre/bin
Please set the JAVA_HOME variable in your environment to match the location of your Java installation.

Now, when I do a good old ‘ls /usr/java7_64/jre/bin’, it looks great! I see 22 files including java, java_vm, j9vm, etc. *** One thing I DON’T see is javac. Maybe that’s cause it’s a jre. Obviously, JAVA_HOME is correctly set, and gradle is correctly reading it. Why is gradle rejecting this java installation? Thanks in advance…

A colleague pointed me at this link and suggested that I change my JAVA_HOME from /usr/java7_64/jre/bin to just /usr/jkava7_64. This worked. The link :
Google suggest you update the gradle script

if [ -n “$JAVA_HOME” ] ; then
if [ -x “$JAVA_HOME/jre/sh/java” ] ; then
# IBM’s JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x “$JAVACMD” ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."

Try and reset the JAVA_HOME in dsbuild profile

From
$ echo $JAVA_HOME
/usr/java7_64/jre/bin

$ echo $JAVA_HOME
/usr/java7_64

Al White
Sr. Unix Admin AIX / Linux
Office 734-913-3826
Cell 734-260-5618
ricwhite@us.ibm.com

IBM Watson Health TM

From: Michael Shulman/Detroit/Contr/IBM
To: Al White/Detroit/IBM@IBMUS
Date: 07/18/2018 01:03 PM
Subject: Re: Who is on the Unix Build Server team?

thusmiannadv21.

  • Michael