Maggie Mao
Maggie Mao

Reputation: 187

CentOS 6.9 : bash: PATH is not a valid identifier

So I am trying to set up the JAVA_HOME and PATH variables for my CentOS 6.9 virtual machine. After installing Java, I did the following:

$ vi ~/.bashrc

Then in .bashrc I added:

export JAVA_HOME=/Downloads/jdk1.8.0_191
export PATH =$JAVA_HOME/bin

When I did

$ source ~/.bashrc

I got the bash error saying that /Downloads/jdk1.8.0_191/bin is not a valid identifier. I tried commenting out the export PATH part, and with only the export JAVA_HOME it worked. I looked inside the jdk1.8.0_191 folder, and the bin folder does exist in there. I wonder what could cause the problem?

I have read question @45426520 before, and we are probably experiencing similar problems. However, I did not understand half the question, and still really need a solution for the CentOS operating system.

Upvotes: 0

Views: 99

Answers (1)

Stefan Freitag
Stefan Freitag

Reputation: 3608

Removing the space between PATH and =$JAVA_HOME/bin should solve your issue.

Have a look an the man page of export. With the space inbewteen. export will only take PATHinto account and ignore the rest of the line. This rest is interpreted by bash, and here /Downloads/jdk1.8.0_191/bin is not a valid identifier.

Upvotes: 1

Related Questions