且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

即使在类路径中的Jar中也找不到类

更新时间:2022-06-11 23:33:25

我弄清楚出了什么问题。

I figured out what was wrong.

事实证明,当您将代码导出到JAR时,我正在使用的环境(Eclipse!)无法正确更新清单文件文件。如果没有正确的清单条目,应用程序就无法找到依赖的jar文件。

It turns out that the environment I am using (Eclipse!) does not properly update the manifest file when you export your code to a JAR file. Without the proper manifest entries, the application cannot "find" the dependent jar files.

在我看来,这是对Eclipse人员的严重疏忽 - - 特别是当你的应用程序依赖于很多jar文件时。为了让我的应用程序运行,我有以下选择:

This is, in my opinion, a serious oversight on the part of the Eclipse folks -- especially when you have an application that depends on a lot of jar files. In order to make my application run, I had the following choices:


  1. 创建一个运行jvm的脚本,并有一个参数列表到每个需要的jar文件,或者:

2:手动将每个必需的jar文件输入清单文件

2: Manually enter each required jar file into the Manifest file

据我所知,没有办法自动更新清单文件。这是一个严肃的PITA(A **中的痛苦)......

To my knowledge, there is no way to automatically update the manifest file. This is a serious PITA (Pain In The A**)...

无论如何,很抱歉打扰了这个问题的人。希望发布这个答案可以帮助其他人避免类似的问题......

Anyway, sorry for bothering people about this problem. Hopefully, posting this answer will help others avoid similar problems...