英文:
How to disable Security Manager while running JUnit tests in Intellij 2020.1?
问题
我在Intellij 2020.1中运行几个JUnit测试时遇到以下错误:
Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/home/ubuntu/build-target/deployment/policies.properties" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:886)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at java.io.FileInputStream.<init>(FileInputStream.java:127)
有人可以告诉我如何在Intellij中禁用安全管理器以避免出现上述错误吗?
我尝试通过Help -> Edit Custom VM Options
设置-Dtests.security.manager=false
,但仍然不起作用。
Java - OpenJDK 8
英文:
I am getting an error like below for few of my JUnit tests running in Intellij 2020.1.
Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/home/ubuntu/build-target/deployment/policies.properties" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:886)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at java.io.FileInputStream.<init>(FileInputStream.java:127)
Can someone let me know how can I disable Security Manager in Intellij to get around the error like above?
I have tried setting -Dtests.security.manager=false
via Help -> Edit Custom VM Options
. But it is still not working?
Java - OpenJDK 8
答案1
得分: 2
你需要在你的运行配置的“VM选项”中设置“-Dtests.security.manager=false”。
英文:
You need to set "-Dtests.security.manager=false" in your Run configuration "VM options".
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论