The magic question
It’s the first time I’ve encountered this kind of error. When creating a new Java project, the test package is named java.test.tt font>, write the main method to run, and the error will be reported as follows:
First pop up window:
Second pop up window:
Detailed error information:
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.test.tt
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:662)
at java.lang.ClassLoader.defineClass(ClassLoader.java:761)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
solve:
Do not use Java as the beginning of the package name, for example, error demonstration: java.test.tt 。
Why?
When loading a Java class, you are restricted to throwing an exception if the package name starts with Java. This should also be to ensure the security of classes in JDK when loading classes.
Read More:
- A JNI error has occurred, please check your installation and try again
- Java command line uses a JNI error has occurred, please check your installation and try again
- Problems encountered after Maven installation or upgrade: could not find or load main class org.codehaus.plexus .class…..
- Error: a JNI error has occurred
- Android AS Run main Method Error [How to Solve]
- “Error: a JNI error has occurred” and “error of” jvm.cfg To solve the problem
- Eclipse:An error has occurred. See error log for more details. java.lang.NullPointerException
- Start Eclipse and pop up the “Failed to load the JNI shared library jvm.dll” dialog box
- The solution of a Java exception has occurred. And error exception in thread when eclipse runs
- Go run error go run: cannot run non main package
- Successful solution of eclipse startup error Error:Could not create the Java Virtual Machine Error:A fatal exception has occurred
- Error running Eclipse: failed to load the JNI shared library
- Eclipse reported an error: an error has occurred
- Eclipse startup error: an error has occurred.See the log file E:\workspace\.metadata\.log.
- Eclipse software Java solution: editor does not contain a main type error box
- Eclipse reports Failed to load the JNI shared library jvm.dll error solution
- An Ajax HTTP error occurred in drupal7 installation occurred.HTTP Result Code
- An error occurred authenticating. Please try again later
- Eclipse automatic prompt setting method and optimization
- After eclipse eclipse eclipse imports the correct project, an error is reported in XML and other files