将Jar文件放入ClassPath [英] Putting a Jar file in ClassPath

查看:321
本文介绍了将Jar文件放入ClassPath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的一种情况是,提取jar文件然后运行它应该启动应用程序的安装程序。这不是我开发的应用程序。
解压缩jar文件并尝试执行后,出现以下错误:-

I have a situation where extracting the jar file and then running it should start the setup for an application. This is not an application developed by me. After i extarct the jar file and try to execute it i get the following error :-

线程 main中的异常java.lang.NoClassDefFoundError:
org / jdesktop / swingx / JXBusyLabel

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/swingx/JXBusyLabel

我已经下载了具有该类的依赖jar文件,但是由于类路径上的概念较弱,我无法弄清楚我可以将下载的jar放在类路径中。这样我就可以开始设置应用程序了。

I have already downloaded the dependent jar file which has the class, however due to weak concepts on classpaths i cannot figure out how can i put the downloaded jar in the classpath.So that i can start setup of the application.

非常感谢

推荐答案

我不明白为什么您必须提取任何内容。使它成为可执行的JAR。

I don't see why you should have to extract anything. Make it an executable JAR.

您将在JAR清单中包含CLASSPATH。请参阅此链接以了解如何进行设置

You'll have the CLASSPATH in your JAR manifest. See this link to learn how to set it up.

,或者在运行时只需在java.exe上使用-classpath选项即可添加它:

or you can just use the -classpath option on java.exe when you run to add it:

java -classpath .;jar1;jar2 <full-name-of-class-with-main-to-run>

这篇关于将Jar文件放入ClassPath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆