We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
在跨平台(Linux 和 Windows)上使用 usb4java 已经一年了,效果很好。
请参阅:
http://usb4java.org/
他们非常活跃,并且拥有非常好的 javax USB 前端。
Been using usb4java for a year on cross platfom (Linux and Windows) and it works great.
See:
http://usb4java.org/
They are very active and have a very good javax USB front.
Java 中没有与 C# 的 USB 支持相当的功能。 jUSB 和 Java-USB 都严重过时,并且可能无法用于任何重要的应用程序开发。
如果您想实现跨平台 USB 应用程序,那么最好的选择是编写一个抽象的 JNI 与 Linux、Mac 和 Windows 本机库交互的界面,您必须自己编写。我会考虑 LibUSB 来处理 Mac 和 Linux。正如您所见,Windows 非常简单。我刚刚结束了一个为期一年的项目,就是这样做的,不幸的是,这是唯一认真的跨平台解决方案。如果您不必在 Windows 上实现并且您的需求有限,您可以使用较旧的 Java 库之一(jUSB 或 Java-USB)。任何需要在 Win32/Win64 上部署的内容都需要本机组件。
There is nothing equivalent to C#'s USB support in Java. Both jUSB and Java-USB are severely out-of-date and likely unusable for any serious application development.
If you want to implement a cross-platform USB application, really your best bet is to write an abstract JNI interface that talks to Linux, Mac and Windows native libraries that you'll have to write yourself. I'd look at LibUSB to handle Mac and Linux. Windows, as you've seen, is pretty straightforward. I just came off a year-long project that did just this, and unfortunately this is the only serious cross-platform solution. If you don't have to implement on Windows and your needs are limited, you may get by with one of the older Java libs (jUSB or Java-USB). Anything that needs to deploy on Win32/Win64 will need a native component.
您可能想看看 usb4java - http://usb4java.org/index.html 它出现支持 Windows、Linux 和 Mac OS,并且在发布时似乎是最新的。不幸的是,它处于 LGPL 之下,因此可能不适合商业开发。
You might want to have a look at usb4java - http://usb4java.org/index.html it appears to support Windows, Linux and Mac OS's and appears to be reasonably current at the time of posting. Is unfortunately under the LGPL so may not be suitable for commercial development.
请参阅 jUSB 或 usb4java 库。
See the jUSB or usb4java libraries.
Java 通信 API。这应该提供与 C# System.IO.Ports< 类似的功能/a> 命名空间。
The Java Communications API. This should provide similar functionality to the C# System.IO.Ports namespace.
如果您使用的是 Mac,则可以通过 /Volumes/ 目录访问 USB。
示例:
您想要写入“Drive”中的文件,因此文件路径为:
/Volumes/Drive/file.whatever
不确定它在其他平台上是如何完成的,但这是最简单的方法我在Mac上找到了
If you're on a mac, USB's can be accessed with the /Volumes/ directory.
Example:
You want to write to a file in "Drive", so the filepath would be:
/Volumes/Drive/file.whatever
Not sure how it's accomplished on other platforms, but this is the simplest way I've found on a mac