Java - 从 3 个独立的 .jar 文件安装程序很困难(涉及 CLASSPATH)

发布于 2024-09-24 14:23:18 字数 723 浏览 2 评论 0原文

我在运行一些 Java 代码时遇到了一些问题,这需要使用三个 .jar 文件。我不知道如何处理它们——我尝试设置 CLASSPATH(并按照自述文件中的说明进行操作),但无济于事。

我想知道是否有人可以引导我完成它?我想对于那些知道自己在做什么的人来说,三个 .jar 文件将是一个简单的安装。

如果有帮助的话,我几乎可以直接使用 Ubuntu(但我确实安装了 JDK 和 Eclipse!)

运行时库: http://cogcomp.cs.illinois.edu/download/software/20

需要其他 .jar:http://cogcomp.cs.illinois.edu/download/software/23

我最终需要运行的程序: http://cogcomp.cs.illinois.edu/download/software/26

如果您愿意提供帮助,我对你感激不尽——你值得一百万个荣誉!

G

I'm having a little trouble running some Java code, which requires three .jar files to be used. I'm at a lost as to what to do with them--I've tried setting the CLASSPATH (and following the instructions for how to do so in the readme files), but to no avail.

I was wondering if someone could walk me through it? I'd imagine three .jar files would be an easy install for someone who knows what they're doing.

If it helps, I'm using Ubuntu pretty much right out of the box (but I do have JDK and Eclipse installed!)

Runtime library: http://cogcomp.cs.illinois.edu/download/software/20

Additional .jar needed: http://cogcomp.cs.illinois.edu/download/software/23

Program I ultimately need to run: http://cogcomp.cs.illinois.edu/download/software/26

If you're willing to help, I can't thank you enough--you deserve a million kudos!

G

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

北风几吹夏 2024-10-01 14:23:18

这些都是 JAR 文件。当您通过双击或使用 java -jar 执行 JAR 文件时,CLASSPATH 环境变量以及 -cp-classpath< /code> 参数被忽略。类路径应在 JAR 的 META-INF/MANIFEST.MF 文件中定义。在这种特殊情况下,只有第二个和第三个 JAR 在清单文件中具有 Class-Path 条目:

Class-Path: LBJ2Library.jar

这是第一个 JAR。类路径表明它期望 LBJ2Library.jar 与您要执行的 JAR(第二个或第三个)位于同一文件夹中。

因此,只需将它们全部放在同一个文件夹中并通过 java -jar LBJPOS.jar 执行即可。

Those are all JAR files. When you execute a JAR file by doubleclicking or using java -jar, the CLASSPATH environment variable and the -cp and -classpath arguments are ignored. The classpath should be defninied in META-INF/MANIFEST.MF file of the JAR. In this particular case, only the second and third JAR have a Class-Path entry in the manifest file:

Class-Path: LBJ2Library.jar

Which is the first JAR. The classpath is telling that it is expecting the LBJ2Library.jar to be in the same folder as the JAR you'd like to execute (either the second or third one).

So, just drop them all in the same folder and execute by java -jar LBJPOS.jar.

じее 2024-10-01 14:23:18

如果您使用 java -jar 来运行 jar 文件,则 CLASSPATH 变量将被忽略。如果您使用 java -jar,您有两种选择:

  1. 将三个 jar 合并为一个 jar。
  2. 运行主类目录,不要使用-jar

If you are using java -jar to run your jar files, then the CLASSPATH variable is ignored. If you are using java -jar, you have two options:

  1. Combine the three jars into one jar.
  2. Run the main class directory and don't use -jar.
森末i 2024-10-01 14:23:18

如今,通常不鼓励使用 CLASSPATH 环境变量。这是它的完成方式(在 Linux 上):

java -cp library1.jar:library2.jar:mainapp.jar <fully qualified name of main class>

Use of the CLASSPATH environment variable is generally discouraged nowadays. This is how it's done (on Linux):

java -cp library1.jar:library2.jar:mainapp.jar <fully qualified name of main class>
心房敞 2024-10-01 14:23:18

您需要设置 CLASSPATH 。将所有 3 个 jar 放在一个文件夹中,将其命名为 lib
请参阅下面设置类路径

set CLASSPATH=%CLASSPATH%:lib;

You need to set the CLASSPATH .place all the 3 jars in a folder , name it as lib
See below to set classpath

set CLASSPATH=%CLASSPATH%:lib;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文