0

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

[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!

HeyLameRobin
  • 159
  • 1
  • 3
  • 12

2 Answers2

1

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

emilianolch
  • 177
  • 6
0

Use sudo instead. This might help you:

sudo nano ~/.bashrc
GustavoP
  • 1
  • 1