如果我启动应用程序时没有调用security manager,那么应用程序运行时不会出错,但是当我启动应用程序调用java security manager时,我会收到以下错误代码。我在windows10环境、Eclipse2020-09(4.17.0)和javase-14模块化编程中运行。我根本不明白需要什么权限才能消除此错误消息:拒绝访问(“java.util.propertypermission”“javafx.verbose”“read”),如果答案只是我需要授予上述权限,那么我在哪里授予此权限,以及向谁授予此权限?任何朝着正确方向的轻推都将受到极大的赞赏。
启动代码/批处理文件:
@echo off
set JLINK_VM_OPTIONS=
set DIR=%~dp0
"%DIR%\java" -Djava.security.manager -Djava.security.policy==./jaasPolicy.policy -Djava.security.auth.login.config==./jaasConfig.config %JLINK_VM_OPTIONS%
-m fm.core/fm.core.main.Driver %*
完整错误消息:
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "javafx.verbose" "read")
at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.base/java.security.AccessController.checkPermission(AccessController.java:1036)
at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:408)
at java.base/java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1152)
at java.base/java.lang.System.getProperty(System.java:847)
at java.base/java.lang.Boolean.getBoolean(Boolean.java:266)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$static$0(LauncherImpl.java:122)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.<clinit>(LauncherImpl.java:121)
... 5 more
暂无答案!
目前还没有任何答案,快来回答吧!