Categories
SysOps

How to define JAVA_HOME

Determine and set JAVA_HOME to execute Java command-line applications.

Determine JAVA_HOME using java binary location.

$ readlink -f $(which java) | sed s:bin/java::
/usr/lib/jvm/adoptopenjdk-11-hotspot-jre-amd64/

Use these instructions to set JAVA_HOME and execute the Java command-line application.

$ sudo -u java_user bash -c "JAVA_HOME=$(readlink -f $(which java) | sed s:bin/java::) /usr/libexec/java_application/app consume"