java.security.NoSuchProviderException: JCE cannot authenticate the provider BC解决方法

java.security.NoSuchProviderException: JCE cannot authenticate the provider BC

异常如题所示。

使用bcprov-jdk15on-147.jar包获取证书私钥出错

在java.security中添加如下语句是可行的
security.provider.N=org.bouncycastle.jce.provider.BouncyCastleProvider

但是不想每次在不同电脑中运行都添加这条语句,太麻烦
于是上网查找到如下代码中可在程序中加入第三方安全提供类
Security.addProvider(new BouncyCastleProvider());

于是出现奇怪的现象,我在MyEclipse中运行正常(即没有在java.security添加org.bouncycastle.jce.provider.BouncyCastleProvider也能运行正常),但是export出 runnable jar file,并选择Package required libraries into generated JAR导出可运行JAR包后,运行就报如题错误:
java.security.NoSuchProviderException: JCE cannot authenticate the provider BC

顺便提一下,我是编写bat批文件来运行这个jar包的。
请大虾指教啊!
------解决方案--------------------
导出时runnable jar时,library handling参数选择第三项“copy required libraries into a sub........”