Tag Archives: Error: A JNI error has occurred

[Solved] Error: A JNI error has occurred, please check your installation and try again Exception in thread

Problem description

When running code. The following error is reported:

"D:\Program Files\Java\jdk1.8.0_301\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54797,suspend=y,server=n -javaagent:C:\Users\Administrator\AppData\Local\JetBrains\IntelliJIdea2020.3\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "D:\program files\Java\jdk1.8.0_301\jre\lib\charsets.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\deploy.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\access-bridge-64.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\cldrdata.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\dnsns.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\jaccess.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\jfxrt.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\localedata.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\nashorn.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\sunec.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\sunjce_provider.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\sunmscapi.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\sunpkcs11.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\ext\zipfs.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\javaws.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\jce.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\jfr.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\jfxswt.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\jsse.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\management-agent.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\plugin.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\resources.jar;D:\program files\Java\jdk1.8.0_301\jre\lib\rt.jar;E:\JetBrains\spring学习\spring-study\spring-study-01-ioc1\target\test-classes;E:\JetBrains\spring学习\spring-study\spring-study-01-ioc1\target\classes;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\springframework\spring-webmvc\5.3.10\spring-webmvc-5.3.10.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\springframework\spring-aop\5.3.10\spring-aop-5.3.10.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\springframework\spring-beans\5.3.10\spring-beans-5.3.10.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\springframework\spring-context\5.3.10\spring-context-5.3.10.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\springframework\spring-core\5.3.10\spring-core-5.3.10.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\springframework\spring-jcl\5.3.10\spring-jcl-5.3.10.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\springframework\spring-expression\5.3.10\spring-expression-5.3.10.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\springframework\spring-web\5.3.10\spring-web-5.3.10.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\junit\junit\4.13\junit-4.13.jar;D:\java\maven-3.8.1-bin\apache-maven-3.8.1\maven_repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\program files\JetBrains\IntelliJ IDEA 2020.3.4\lib\idea_rt.jar" java.MyTest01
Connected to the target VM, address: '127.0.0.1:54797', transport: 'socket'
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Prohibited package name: java
	at java.lang.ClassLoader.preDefineClass(ClassLoader.java:655)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:754)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
Disconnected from the target VM, address: '127.0.0.1:54797', transport: 'socket'

Process finished with exit code 1


Cause analysis:

Through the analysis of the error, I learned that I wrote that the use of java package’s name is prohibited in Java


Solution:

Delete and modify the name of java package to other