Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I'm trying to set JAVA_HOME and path for JDK on Linux using .bashrc. But it says [ Error writing .bashrc: Permission denied ]. Why?

I’m trying to set JAVA_HOME and path for JDK on Linux using .bashrc (through this tutorial):

Step 1:

$ nano .bashrc

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

[Press Enter]

Step 2:

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH

enter image description here

Step 3:

[Type Ctrl+x]

enter image description here

Step 4:

[Type Y]

enter image description here

Step 5:

[Type Enter] (According to this post)

enter image description here

As you can see, it is not allowing me to write .bashrc. What could I be doing wrong? I’ve researched similar errors but none have the same situation I am in. I would appreciate your experience and knowledge in this subject. Thanks!

>Solution :

You’re trying to create a new file in the root directory /, where a normal user doesn’t have permission to write. The file you must edit is located in your home directory, so open the editor this way: nano ~/.bashrc

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading