Java错误:请安装JCE无限强度管辖权策略文件

Java错误:请安装JCE无限强度管辖权策略文件

问题描述:

我正在此Java应用程序上工作,该应用程序需要访问"JCE Unlimited Strength"文件,并且确实安装了它们,并且当我生成jar输出时,在构建解决方案(在Intellij中)时它可以正常工作. ,由于某种原因,它给了我这个烦人的错误:

I am working on this Java application which needs to have access to "JCE Unlimited Strength" files and I DO HAVE installed them and it works properly when I build the solution (in Intellij) BUT when I make a jar output, for some reason it gives me this annoying error:

C:\Users\h\whatever\out\artifacts\Accepter_jar>java -cp Accepter.jar Main
org.apache.poi.EncryptedDocumentException: Export Restrictions in place - please install JCE Unlimited Strength Jurisdic
tion Policy files
        at org.apache.poi.poifs.crypt.CryptoFunctions.getCipher(CryptoFunctions.java:208)
        at org.apache.poi.poifs.crypt.CryptoFunctions.getCipher(CryptoFunctions.java:182)
        at org.apache.poi.poifs.crypt.agile.AgileDecryptor.hashInput(AgileDecryptor.java:269)
        at org.apache.poi.poifs.crypt.agile.AgileDecryptor.verifyPassword(AgileDecryptor.java:116)
        at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:95)
        at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:282)
        at ExcelJob.loadExcelSheet(ExcelJob.java:22)
        at Main.main(Main.java:17)

知道有什么问题吗?

我也遇到过类似的问题,但是使用了Eclipse而不是Intellij. jdk(多个版本)和jre可能是问题.转到您的 C:\ Program Files \ Java 目录,将新下载的JCE jar(取决于Java版本)添加到每个JDK&的 security 文件夹中.您已安装的JRE.

I have gone through similar issue but with eclipse instead Intellij. It could be the problem with the jdk(multiple versions) and jre. Go to your C:\Program Files\Java directory, add the NEWLY DOWNLOADED JCE jars (depending upon the Java version) inside security folder of each of JDK & JRE you have installed.