0

I have Java and Springboot cli added to PATH however, when source /etc/profile it gives error.

And on restarting PC, BASH is not loading.

My export in /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar

export SPRING_HOME=/home/jacobd/spring-2.7.0/bin
export PATH=$SPRING_HOME/bin

Can anyone guide, where I am doing wrong.

1 Answer 1

1

There is no actual error in the code that you show that would provoke source to report an error, so it's unfortunate that you don't mention what that specific error message says. The file does, however, contain a problematic typo (?) that would make it difficult to use the shell after sourcing it.

On that last line, you throw away the old value of PATH and replace it with $SPRING_HOME/bin. The effect of this is that the shell will only find external executables in that single path while ignoring all the standard paths.

I'm assuming you want to append that new path to the PATH variable in a similar way as is done on the 2nd line of the code that you show, rather than replace the old value.

PATH=$PATH:$SPRING_HOME/bin

Note that after exporting a variable, it remains exported, so there's no need to export it again (unless you explicitly unset it).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .