Neel Shah Neel Shah -5 years ago 156
Java Question

.bashrc giving error after settin $JAVA_HOME PATH

I am getting the following error after setting JAVA_HOME path in bashrc:

bash: export: `=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/java/jdk1.8.0_91/bin': not a valid identifier

bashrc file:

#JAVA HOME directory setup
export JAVA_HOME="/usr/lib/java/jdk1.8.0_91"
export PATH =$PATH:$JAVA_HOME/bin

When I do echo_$JAVA_HOME, I get the correct path as:

When I execute the command which java, I get the result as:

What can be the possible solution to solve this problem?

Answer Source

In shell while setting a variable there should be no space between the valirable name and = character. Just change

export PATH =$PATH:$JAVA_HOME/bin


export PATH=$PATH:$JAVA_HOME/bin
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download