Java报错信息 java.lang.SecurityException: Prohibited package name: java.xxx

时间:2022-06-26 08:15:13
package java.yun.System;

public class SystemOut {
public static void main(String[] args) {
System.out.println(
"输出");
}
}

报错信息

java.XXXXXXXXX
java.lang.SecurityException: Prohibited
package name: java.XXXXX
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:
658)
at java.lang.ClassLoader.defineClass(ClassLoader.java:
794)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:
449)
at java.net.URLClassLoader.access$
100(URLClassLoader.java:71)
at java.net.URLClassLoader$
1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$
1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:
354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:
425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:
358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:
482)
Exception in thread
"main"
Process finished with exit code
1

原因 JVM禁止包的开头为java

解决方法 请自行脑补。