Add the doPrivileged in the main method: public static void main(String... args) throws Throwable { try { AccessController.doPrivileged(new PrivilegedExceptionAction<>() { @Override public Void run() throws Exception { new Main(System.err).run(VM.getRuntimeArguments(), args); return null; } }); } catch (PrivilegedActionException pae) { Throwable e = pae.getCause(); if (e instanceof Fault) { System.err.println(e.getMessage()); System.exit(1); } else if (e instanceof InvocationTargetException) { // leave VM to handle the stacktrace, in the standard manner throw e.getCause(); } } } And also add doPrivileged around new URL call and grant AllPermission to jdk.compiler diff --git a/src/java.base/share/lib/security/default.policy b/src/java.base/share/lib/security/default.policy --- a/src/java.base/share/lib/security/default.policy +++ b/src/java.base/share/lib/security/default.policy @@ -112,6 +112,10 @@ permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.cs"; }; +grant codeBase "jrt:/jdk.compiler" { + permission java.security.AllPermission; +}; + grant codeBase "jrt:/jdk.crypto.ec" { permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";