在Mac上添加javax.comm API [英] add javax.comm API on a mac

查看:118
本文介绍了在Mac上添加javax.comm API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个与串行设备(手持扫描器)通信的Java应用程序,以便该应用程序与平台无关. 我找到了一些代码示例,当我将它们复制到Eclipse中时,它说缺少javax.comm.*. 如何在Mac上安装此软件? 以及如何将该库添加到我的应用程序中,以便用户无需安装任何东西?

I would like make an java app that communicates with a serial device(handheld scanner) so that the app is platform independent. I have found a few code examples, and when I copy them into Eclipse it says that javax.comm.* is missing. How do I install this on my Mac? And how do I add this library to my app so that the users does not have to install anything?

我希望能够为用户提供一个jar文件和设备,他们应该能够在Windows/Mac/Linux上运行它而无需进行任何配置.

I want to able to give the users a jar file and the device, and they should be able to run it on windows/Mac/Linux without little or none configuration.

我找到了一个下载文件,可以在其中下载javax.comm.jar文件,但是该下载文件包含一个win32comm.dll,该文件依赖于某些方式-至少那是我将jar文件添加到项目中时遇到的错误.

I found a download where I could download a javax.comm.jar file but the download included a win32comm.dll it dependented on some how - at least that was the fault I got when I added the jar file to my project.

Error loading win32com: java.lang.UnsatisfiedLinkError: no win32com in java.library.path

推荐答案

这是Java Communications API.您可以在此处获得它,但是它对您没有帮助.受支持的平台是Solaris SPARC,Solaris x86和Linux x86.

This is the Java Communications API. You can get it here but it won't help you. The supported platforms are Solaris SPARC, Solaris x86, and Linux x86.

对于Mac和Linux,如果已经配置了串行端口,则可以将/dev/ttyS0,/dev/ttyS1,/dev/ttyS2等打开为文件并对其进行读/写操作.在Windows上,如果已经配置了串行端口,则可以打开"COM1","COM2"等进行读写.

For Mac and Linux, if the serial port is already configured, you can open /dev/ttyS0, /dev/ttyS1, /dev/ttyS2, etc. as a file and read/write to it. On Windows, if the serial port is already configured you can open "COM1", "COM2", etc. and read and write to it.

不幸的是,javax.comm(如参考实现中所提供的)不是跨平台的,因此您必须要么捆绑其他本机库和支持类,要么使用依赖于平台的方式来配置串行港口.在Windows上,这可能是模式"命令,在Mac/Linux上,这可能是stty命令.

Unfortunately, javax.comm (as provided in the reference implementation) isn't cross-platform, so you'll have to either resort to bundling additional native libraries and supporting classes or use a platform-dependent way to configure the serial port. On Windows, this could be the "mode" command, and on Mac/Linux, this could be the stty command.

这篇关于在Mac上添加javax.comm API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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