java打包带有org.bouncycastle依赖的jar,在执行时出现“找不到主类”。

huangapple 未分类评论42阅读模式
英文:

java packaging a jar with org.bouncycastle as a dependency causes "main class not found" on execution

问题

我目前正在尝试打包我的Java应用程序,该应用程序使用docker-java作为依赖。Docker-java使用org.bouncycastle:bcpkix-jdk15on:1.60org.bouncycastle:bcprov-jdk15on:1.60作为依赖。当我使用IntelliJ构建或Maven将项目打包成一个jar文件时,以下四个文件会被创建在META-INF文件夹中:BC1024KE.DSABC1024KE.SFBC2048KE.DSABC2048KE.SF

当我尝试执行该jar文件时,会出现以下错误:Error: Mainclass de.dert.Main couldn't be found or loaded

但是,当我删除这四个文件后,我可以执行我的程序。

您知道我如何在不删除这些文件的情况下使其工作吗?

英文:

I am currently trying to package my java application, which uses docker-java as a dependency. Docker-java uses org.bouncycastle:bcpkix-jdk15on:1.60 and org.bouncycastle:bcprov-jdk15on:1.60 as a dependency. When I package my project into a jar, using IntelliJ build or maven, the following four files are getting created inside the META-INF folder: BC1024KE.DSA, BC1024KE.SF, BC2048KE.DSAand BC2048KE.SF.

When I try to execute the jar I get the following error: Error: Mainclass de.dert.Main couldn't be found or loaded.

But when I delete the four files I can execute my program.

Do you know how I can get this working without deleting the files?

huangapple
  • 本文由 发表于 2020年4月5日 19:11:55
  • 转载请务必保留本文链接:https://java.coder-hub.com/61041640.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定