简体   繁体   English

java 中的 Com 端口问题

[英]Com port issue in java

I was trying to write COM port using Java.我试图使用 Java 编写 COM 端口。 But when i debug, it gives a window with checkbox for selecting ports showing,但是当我调试时,它给出了一个 window 带有用于选择端口的复选框,

gnu.io.rxtx.properties has not been detected.未检测到 gnu.io.rxtx.properties。 There is no consistant means of detecting ports on this operating System.没有一致的方法来检测此操作系统上的端口。 It is necessary to indicate which ports are valid on this system before proper port enumeration can happen.在正确的端口枚举发生之前,有必要指出该系统上哪些端口是有效的。 Please check the ports that are valid on this system and select Save.请检查此系统上有效的端口并 select 保存。

How can solve this problem.怎么能解决这个问题。

You will need to check if your VM have the required files to initialize the COM port communication?您需要检查您的 VM 是否具有初始化 COM 端口通信所需的文件? If none, you probably have to find those files first.如果没有,您可能必须先找到这些文件。

You might want to check out the webby at:您可能想在以下位置查看 webby:

http://www.oracle.com/technetwork/java/index-jsp-141752.html http://www.oracle.com/technetwork/java/index-jsp-141752.html

also if you need an example, checkout:另外,如果您需要示例,请查看:

http://www.java2s.com/Code/Java/Development-Class/OpenaserialportusingJavaCommunications.htm http://www.java2s.com/Code/Java/Development-Class/OpenaserialportusingJavaCommunications.htm

Hope it helped.希望它有所帮助。

Cheers, Vern干杯,弗恩

The window you are describing is part of the RXTX library.您描述的 window 是 RXTX 库的一部分。 The RXTXcomm.jar has a Configure class which contains a main method. RXTXcomm.jar 有一个配置 class 包含一个主要方法。 You are seeing the popup because you are running the main method from Configure and not debugging your application.您看到弹出窗口是因为您正在从 Configure 运行 main 方法,而不是调试您的应用程序。 In your debugger make sure you are actually debugging your code and not the RXTX library.在你的调试器中确保你实际上是在调试你的代码而不是 RXTX 库。

gnu.io also has a main class. gnu.io还有一个主class。 By default Eclipse picks the main method of gnu.io.默认情况下 Eclipse 选择 gnu.io 的主要方法。

Go to Project --> Run As --> Run Configurations --> Java Applications --> (Your Run Configuration) --> Main --> Go 到项目 --> 运行方式 --> 运行配置 --> Java 应用程序 --> (您的运行配置) --> 主要 -->

In Main class textBox use the search button to select your class as the main class.在主要 class 文本框中,使用搜索按钮将 select 您的 class 作为主要 ZA2F2ED4F8EBC2CBB14C21A29DC4ABZ。 Your problem should be fixed你的问题应该得到解决

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

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