When checking that the environment variable is set. echo $ JAVA_HOME

The command returns an empty string. enter image description here

Located in the .bashrc file

export JAVA_HOME = $ (/ usr / lib / jvm / java-8-openjdk-amd64) export PATH = $ JAVA_HOME / jre / bin: $ PATH

When checking other GRADLE_HOME, M2_HOME environments, the command returns the specified path.
Why is that?

    1 answer 1

    You have the wrong syntax. Need to

    export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" 

    What you have written is assigned to the JAVA_HOME variable the standard output of the /usr/lib/jvm/java-8-openjdk-amd64 , as no such command exists, the output is empty.