I was not installed on my PC

Actually java was not installed on my PC. After installing java sudo command run successfully. But now I am facing another problem, when I try to run SNAP, I am getting this error.

"## **An instance of the program cannot access specified user directory. This is a serious problem that may prevent the program to function properly. Make sure /home/user/.snap/system is writeable. **

Click Ok to continue in spite of previous errors. "

Kindly guide how to fix it.