I Am Unable to Set Classpath

When I try to add classpath using export CLASSPATH=/location, it updates the CLASSPATH temporarily.

When I look at the classpath using echo $CLASSPATH, I can see that the changes are updated in classpath, but when I close and reopen the terminal, I can not see the update which I did.

Tell me how to add a classpath permanently.

1

1 Answer

The export CLASSPATH=/location command will work only for the current terminal session. To make the changes permanent add the line

export CLASSPATH=/location

to ~/.bashrc or ~/.profile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest