“java.lang.SecurityException: Prohibited package name: java.sql” error happen only when executing outside of Eclipse

萝らか妹 提交于 2019-12-01 20:56:02

The 'prohibited package name' is thrown, when you are using a class of a package starting with 'java.' that is not found in your rt.jar. Either you created such a class yourself, or you have a .jar file containing such a class in your classpath.

If it's the former, put the class in another package. If it's the latter, try to find the .jar file containing this class (e.g. print out the classpath found in the system property java.class.path)

Ran into this issue when creating a Runnable JAR via Eclipse (Mars).

In the Jar generator I was setting the library handling option to

Package required libraries into generated JAR

but switching to

Extract required libaries

solved the issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!