0

I have recently formatted my system and installed Ubuntu 16.0.4 and done all necessary setup for running react-native project.But since then every time i restart the system, getting following error,

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

I am setting path by using following command,

export JAVA_Home=/home/syamkishore/Downloads/android-studio/jre

If i do so error will be cleared. But if I restart the system again same error occurs.

Can somebody suggest the permanent solution to set the Java path once forever? Thank You.

ThinkAndCode
  • 1,319
  • 3
  • 29
  • 60
  • Possible duplicate of [How to set Java environment path in Ubuntu](https://stackoverflow.com/questions/9612941/how-to-set-java-environment-path-in-ubuntu) – EL173 Dec 27 '18 at 06:00

1 Answers1

1

Edit the system Path file /etc/profile

sudo gedit /etc/profile Add following lines in end

JAVA_HOME=/usr/lib/jvm/jdk1.7.0 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export JRE_HOME export PATH

Please see below link. It explains how to set the java path permanently.

How to set the java class path?

Java-Seekar
  • 1,720
  • 5
  • 30
  • 52