I need to fix the problem of
SecurityException: Can not initialize cryptographic mechanism
Following up on OpenJDK 11 error "Can not initialize cryptographic mechanism", as its answer is unable to solve my problem
inspecting
java.security.properties
from within running JVM:System.getProperty("java.security.properties");
It should be present and pointing at a file. Inspect that file and make sure it has the following property
crypto.policy=unlimited
and the folder called unlimited is available from where the policy file is.
However, I got null
output for both java under Windows and Linux.
The above answer said that
it is <jre_home>/conf/security/policy/
and my situation is that I don't have jre
however I do have the /conf/security/policy/
directory under java_home
, for both java under Windows and Linux.
Directory of C:\Program Files\OpenJDK\jdk-18.0.1.1\conf\security\policy
04/25/2022 04:59 PM <DIR> .
04/25/2022 04:59 PM <DIR> ..
04/25/2022 04:59 PM <DIR> limited
04/25/2022 04:59 PM 2,390 README.txt
04/25/2022 04:59 PM <DIR> unlimited
1 File(s) 2,390 bytes
$ ls -l /home/foo/.sdkman/candidates/java/17.0.3-oracle/conf/security/policy
total 4
-rw-r----- 1 foo foo 2390 2022-03-09 17:40 READfoo.txt
drwxrwx--x 1 foo foo 4096 2022-06-03 12:45 limited
drwxrwx--x 1 foo foo 4096 2022-06-03 12:45 unlimited