0
votes

I am trying to set JAVA_HOME in my ubuntu machine ,for that i've added the following path in /etc/environment

"JAVA_HOME":"/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin"

and reloaded the source /etc/environment.

but i got the following error

bash: JAVA_HOME:/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin: No such file or directory

But the path is exists

Note

The same error occures while i am trying to install hyperledger sawtooth https://sawtooth.hyperledger.org/docs/core/releases/1.0/app_developers_guide/ubuntu.html.

hyperledger sawtooth ububtu installation requires the java

Ubuntu version

Ubuntu 16.04.3 LTS

Also i've adde the following in .bashrc file

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/bin
export PATH=$PATH:/usr/lib/jvm/java-8-openjdk-amd64/bin
1
Use alternatives. And I don't really think you're Batman. - Abhijit Sarkar

1 Answers

2
votes

/etc/environment is as well a bash script, so change the line with

"JAVA_HOME":"/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin"

which is not bash variable syntax to:

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

Also note the above uses the base directory not the bin directory for the JAVA_HOME environment variable.