# java
if [ -d "$HOME/Downloads/jdk1.8.0_152" ] ; then
JAVA_HOME="$HOME/Downloads/jdk1.8.0_152"
fi
if [ -d "$HOME/Downloads/jdk1.8.0_152/bin" ] ; then
PATH="$HOME/Downloads/jdk1.8.0_152/bin:$PATH"
fi
I already have Java installed and if I type which java it shows:
/home/aero/Downloads/jdk1.8.0_152/bin/java
and if I type java -version it shows:
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
but if I want to install elasticsearch by:
sudo dpkg -i elasticsearch-6.6.1.deb
it shows:
(Reading database ... 285478 files and directories currently installed.)
Preparing to unpack elasticsearch-6.6.1.deb ...
could not find java; set JAVA_HOME or ensure java is in PATH
dpkg: error processing archive elasticsearch-6.6.1.deb (--install):
new elasticsearch package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
elasticsearch-6.6.1.deb