ThinkAndCode
ThinkAndCode

Reputation: 1667

Is it necessary to set the JAVA_HOME variable every time system is restarted?

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.

Upvotes: 0

Views: 1230

Answers (1)

Java-Seekar
Java-Seekar

Reputation: 1770

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?

Upvotes: 1

Related Questions