Java - 从 3 个独立的 .jar 文件安装程序很困难(涉及 CLASSPATH)
我在运行一些 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这些都是 JAR 文件。当您通过双击或使用
java -jar
执行 JAR 文件时,CLASSPATH
环境变量以及-cp
和-classpath< /code> 参数被忽略。类路径应在 JAR 的 META-INF/MANIFEST.MF 文件中定义。在这种特殊情况下,只有第二个和第三个 JAR 在清单文件中具有
Class-Path
条目:这是第一个 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
, theCLASSPATH
environment variable and the-cp
and-classpath
arguments are ignored. The classpath should be defninied inMETA-INF/MANIFEST.MF
file of the JAR. In this particular case, only the second and third JAR have aClass-Path
entry in the manifest file: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
.如果您使用 java -jar 来运行 jar 文件,则 CLASSPATH 变量将被忽略。如果您使用
java -jar
,您有两种选择:-jar
。If you are using
java -jar
to run your jar files, then the CLASSPATH variable is ignored. If you are usingjava -jar
, you have two options:-jar
.如今,通常不鼓励使用 CLASSPATH 环境变量。这是它的完成方式(在 Linux 上):
Use of the CLASSPATH environment variable is generally discouraged nowadays. This is how it's done (on Linux):
您需要设置 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;