简体   繁体   English

如何在java中集成外部包?

[英]How to integrate external packages in java?

I'm trying to develop an app that uses Bluetooth technology, so I need javax.bluetooth & javax.obex & javax.microedition packages.我正在尝试开发一个使用蓝牙技术的应用程序,所以我需要 javax.bluetooth & javax.obex & javax.microedition 包。 I've downloaded it but I don't know how to properly place it and where so the Java can see it while compilation.我已经下载了它,但我不知道如何正确放置它以及在哪里,以便 Java 在编译时可以看到它。 How do I integrate it?我如何集成它?

It depends on what tool you're using to create your jar.这取决于您用于创建 jar 的工具。 For example: Maven , Eclipse or IntelliJ .例如: MavenEclipseIntelliJ Usually you can find an answer that is relevant to your build method by simply googling it.通常,您只需通过谷歌搜索就可以找到与您的构建方法相关的答案。

However, if you want to permenantly add them to your JDK, you'll have to paste them in your JDK's integrated jre into the following folder: \\jre\\lib\\ext但是,如果您想将它们永久添加到 JDK,则必须将它们粘贴到 JDK 的集成 jre 中的以下文件夹中:\\jre\\lib\\ext

For me that would be: C:\\Program Files\\Java\\jdk1.8.0_231\\jre\\lib\\ext对我来说就是:C:\\Program Files\\Java\\jdk1.8.0_231\\jre\\lib\\ext

我的文件夹

As you can see, I added RXTX (a serial comm library) to mine and I can now use it in my code.如您所见,我向我添加了 RXTX(一个串行通信库),现在我可以在我的代码中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM