Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.io.t

2023-11-13 20:04:46 浏览数 (2)

学习小测试:

报错信息如下:

代码语言:javascript复制
Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.io.test
	at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:898)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)

译:线程“main”java.lang.securityException中出现异常:禁止的包名称:java.io.test

问题:可能是与java自带包名冲突, 解决:修给包名尝试,问题得到解决。

0 人点赞