如何在Java中使用第三方包 [英] How to use 3rd party packages in Java

查看:489
本文介绍了如何在Java中使用第三方包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发我的第一个实际需要第三方软件包的Java应用程序,现在我对如何实际使用它感到迷茫。我需要的软件包来自 VLCJ ,以便我可以在我的GUI中嵌入媒体播放器。

I'm developping my first Java application which actually needs a 3rd party package and now I'm lost as to how to actually use it. The packages I need are from VLCJ so that I can embed a media player in my GUI.

通常,我可以导入包和类,但第三方包可以实现吗?他们有一个.jar文件可以在他们的网站上下载,那些包存储在那里?如果是这样,我如何在我自己的应用程序中使用它们?

Usually, I can just import packages and classes, but is this possible with 3rd party packages? They have a .jar file to download at their website, are the packages stored in that? And if so, how do I go about using them in my own application?

推荐答案

您只需要第三方JAR即可在您的项目的类路径上。你在用什么IDE?在Eclipse中你可以这样做:

You just need the third party JAR to be on your project's classpath. What IDE are you using? In Eclipse you would do:


转到
左边的Package Explorer窗口。选择你工作的
的Java项目,然后右键单击。单击
属性。然后单击Java Build
Path。单击Add External Jars。

Go to Package Explorer window on the left. Select the Java project you are working on and right click. Click Properties. Then click Java Build Path. Click Add External Jars.

或者您可以修改系统范围的CLASSPATH以包含JAR。或者您可以在命令行上执行此操作,例如

Or you could modify your system wide CLASSPATH to include the JAR. Or you can do it on the command line e.g.

java -classpath C:\java\thirdpartjars\thirdparty.jar MyProgram

(你可以使用 javac 也是。)

有许多方法可以解决这个问题。

There are many ways to crack this nut.

这篇关于如何在Java中使用第三方包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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