Main Tutorials

Where is the java.security file?

In Java, we can find the java.security file at the following location:

  1. $JAVA_HOME/jre/lib/security/java.security
  2. $JAVA_HOME/conf/security

For Java 8, and early version, we can find the java.security file at $JAVA_HOME/jre/lib/security/java.security.

Terminal

$ /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security$ ls -lsah
total 12K
4.0K drwxr-xr-x 3 root root 4.0K Mei  12 11:53 .
4.0K drwxr-xr-x 8 root root 4.0K Mei  12 11:53 ..
   0 lrwxrwxrwx 1 root root   46 Apr  16 02:48 blacklisted.certs -> /etc/java-8-openjdk/security/blacklisted.certs
   0 lrwxrwxrwx 1 root root   27 Apr  16 02:48 cacerts -> /etc/ssl/certs/java/cacerts
   0 lrwxrwxrwx 1 root root   40 Apr  16 02:48 java.policy -> /etc/java-8-openjdk/security/java.policy
   0 lrwxrwxrwx 1 root root   42 Apr  16 02:48 java.security -> /etc/java-8-openjdk/security/java.security
   0 lrwxrwxrwx 1 root root   36 Apr  16 02:48 nss.cfg -> /etc/java-8-openjdk/security/nss.cfg
4.0K drwxr-xr-x 4 root root 4.0K Mac   4 14:12 policy

For Java 11 and Java 14, we can find the java.security file at $JAVA_HOME/conf/security.

Terminal

$ /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64/conf/security$ ls -lsah
total 64K
4.0K drwxr-xr-x 3 root root 4.0K Mei  12 11:55 .
4.0K drwxr-xr-x 4 root root 4.0K Mei  12 11:55 ..
4.0K -rw-r--r-- 1 root root 2.2K Apr  16 15:12 java.policy
 48K -rw-r--r-- 1 root root  48K Apr  16 15:12 java.security
4.0K drwxr-xr-x 4 root root 4.0K Mei  12 11:55 policy
Terminal

mkyong@mkyong-amd-3900:/usr/lib/jvm/java-14-openjdk-amd64/conf/security$ ls -lsah
total 12K
4.0K drwxr-xr-x 3 root root 4.0K Mac  16 13:59 .
4.0K drwxr-xr-x 4 root root 4.0K Mac  16 13:59 ..
   0 lrwxrwxrwx 1 root root   41 Okt  10  2019 java.policy -> /etc/java-14-openjdk/security/java.policy
   0 lrwxrwxrwx 1 root root   43 Okt  10  2019 java.security -> /etc/java-14-openjdk/security/java.security
   0 lrwxrwxrwx 1 root root   37 Okt  10  2019 nss.cfg -> /etc/java-14-openjdk/security/nss.cfg
4.0K drwxr-xr-x 4 root root 4.0K Mac  16 13:59 policy

References

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
3 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Aleksandr
3 years ago

It was very helpful for me! Thank you!

Peter
3 years ago

First! 🙂 can you create the tutorial about java 15 hidden classes ? 🙂