Ubuntu – “cannot create directory `JAVA’: Permission denied ” how to solve this issue

javapermissions

can anybody help me in solving this issue. I am new to Linux and here's
problem:

gourab@gourab-RV509:/usr/share/java$ cd /
gourab@gourab-RV509:/$ cd usr
gourab@gourab-RV509:/usr$ mkdir JAVA
mkdir: cannot create directory `JAVA': Permission denied
gourab@gourab-RV509:/usr$ 

Best Answer

Instead of mkdir JAVA use sudo mkdir JAVA, then enter your password.

That should fix it.

However, you only really need to use one command instead of these two or three.

cd / 
cd usr 
sudo mkdir JAVA 

cd just changes the directory, no point in doing that. You can simply put the path of the file after mkdir, like so.

sudo mkdir /usr/JAVA