I'm trying to set JAVA_HOME for elasticsearch
but no luck till now.
I tried to set it in .bashrc
, etc/environment
, etc/.profile
all fail.
this is the command I use to run elasticsearch:
sudo /etc/init.d/elasticsearch start
I tried debug the JAVA_HOME variable in terminal like this:
echo $JAVA_HOME
sudo echo $JAVA_HOME
I got the result /home/mockie/softwares/jdk1.8.0_45
for the both which is correct path for my JAVA.
I also tried debug /etc/init.d/elasticsearch
like this:
echo "$JAVA_HOME/dodol"
exit 1
and the result was empty and only return "/dodol".
this is full code for etc/init.d/elasticsearch
:
https://gist.github.com/mockiemockiz/c9547aee791ee04c2e1d
and this is my etc/environment
:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME=/home/mockie/softwares/jdk1.8.0_45
but when I try this :
$ sudo su
$ /etc/init.d/elasticsearch start
and it works! but what I want is to use sudo /etc/init.d/elasticsearch start
without sudo su
first. is it possible?
/etc/enviroment
, you reboot the system?etc/environment
andetc/.bashrc
? is it correcthome/mockie/.bashrc
is just for my profile?sudo /etc/init.d/elasticsearch start
withoutsudo su
first. is it possible?JAVA_HOME
in/etc/environment
dosource /etc/environment
and then check..