When running Intellij Ultimate (version 2019.3.1) it throws this error:
Internal error. Please refer to http://jb.gg/ide/critical-startup-errors
java.lang.SecurityException: Could not lock User prefs. Lock file access denied.
at java.prefs/java.util.prefs.FileSystemPreferences.checkLockFile0ErrorCode(FileSystemPreferences.java:956)
at java.prefs/java.util.prefs.FileSystemPreferences.lockFile(FileSystemPreferences.java:944)
at java.prefs/java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:748)
at java.prefs/java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:843)
at java.prefs/java.util.prefs.FileSystemPreferences.syncWorld(FileSystemPreferences.java:483)
at java.prefs/java.util.prefs.FileSystemPreferences$3.run(FileSystemPreferences.java:450)
at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
at java.base/java.util.TimerThread.run(Timer.java:506)
-----
JRE 11.0.5+10-b520.17 amd64 by JetBrains s.r.o
What's the fix for this?
This User prefs error I presume is the reason why I have to setup and activate IntelliJ each time it is opened.
~/.java/.userPrefs directory, one of its subdirectories or the individual file has wrong permissions so that JVM is not able to write there.
This can occur if you've started some Java app from a different user (such as root) and the directory was created with the permissions for that user.
Another possible reason is that some other process is already holding a lock and manipulating the Java Preferences at the same time.
If it's some other process holding the lock, you can try to find and kill it.
If it's the permissions issue, the easiest solution is to just sudo rm -rf ~/.java/.userPrefs and then start the IDE again.
You can of course inspect the actual owner/permissions for this location and fix them using chown/chmod (recursively with the -R switch).
It's also worth checking the permissions of the .java directory itself and as the last resort you can delete it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With