如何在 Java 中使用 3rd 方包

How to use 3rd party packages in Java(如何在 Java 中使用 3rd 方包)
本文介绍了如何在 Java 中使用 3rd 方包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在开发我的第一个 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 方包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Sending a keyboard event from java to any application (on-screen-keyboard)(将键盘事件从 java 发送到任何应用程序(屏幕键盘))
How to make JComboBox selected item not changed when scrolling through its popuplist using keyboard(使用键盘滚动其弹出列表时如何使 JComboBox 所选项目不更改)
Capturing keystrokes without focus(在没有焦点的情况下捕获击键)
How can I position a layout right above the android on-screen keyboard?(如何将布局放置在 android 屏幕键盘的正上方?)
How to check for key being held down on startup in Java(如何检查在Java中启动时按住的键)
Android - Get keyboard key press(Android - 获取键盘按键)