如何在 Java 中使用 3rd 方包

编程入门 行业动态 更新时间:2024-10-28 04:16:59
本文介绍了如何在 Java 中使用 3rd 方包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发我的第一个 Java 应用程序,它实际上需要一个 3rd 方包,现在我不知道如何实际使用它.我需要的软件包来自 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.

通常,我可以只导入包和类,但是这可以通过 3rd 方包实现吗?他们有一个 .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:

转到包资源管理器窗口左边.选择您所在的 Java 项目工作并右键单击.点击特性.然后点击 Java 构建小路.点击添加外部罐子.

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 hirdpartjars hirdparty.jar MyProgram

(您也可以将参数与 javac 一起使用).

(you can use the argument with javac too).

有很多方法可以解决这个问题.

There are many ways to crack this nut.

更多推荐

如何在 Java 中使用 3rd 方包

本文发布于:2023-11-08 13:15:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569475.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!