<bdo id='6eblM'></bdo><ul id='6eblM'></ul>

    <small id='6eblM'></small><noframes id='6eblM'>

      <legend id='6eblM'><style id='6eblM'><dir id='6eblM'><q id='6eblM'></q></dir></style></legend>
    1. <i id='6eblM'><tr id='6eblM'><dt id='6eblM'><q id='6eblM'><span id='6eblM'><b id='6eblM'><form id='6eblM'><ins id='6eblM'></ins><ul id='6eblM'></ul><sub id='6eblM'></sub></form><legend id='6eblM'></legend><bdo id='6eblM'><pre id='6eblM'><center id='6eblM'></center></pre></bdo></b><th id='6eblM'></th></span></q></dt></tr></i><div id='6eblM'><tfoot id='6eblM'></tfoot><dl id='6eblM'><fieldset id='6eblM'></fieldset></dl></div>
    2. <tfoot id='6eblM'></tfoot>

      CommPortIdentifier.getPortIdentifiers 为空

      时间:2024-08-24
          1. <small id='w9XPN'></small><noframes id='w9XPN'>

              <bdo id='w9XPN'></bdo><ul id='w9XPN'></ul>
            • <i id='w9XPN'><tr id='w9XPN'><dt id='w9XPN'><q id='w9XPN'><span id='w9XPN'><b id='w9XPN'><form id='w9XPN'><ins id='w9XPN'></ins><ul id='w9XPN'></ul><sub id='w9XPN'></sub></form><legend id='w9XPN'></legend><bdo id='w9XPN'><pre id='w9XPN'><center id='w9XPN'></center></pre></bdo></b><th id='w9XPN'></th></span></q></dt></tr></i><div id='w9XPN'><tfoot id='w9XPN'></tfoot><dl id='w9XPN'><fieldset id='w9XPN'></fieldset></dl></div>

                  <tbody id='w9XPN'></tbody>
                <legend id='w9XPN'><style id='w9XPN'><dir id='w9XPN'><q id='w9XPN'></q></dir></style></legend>
                <tfoot id='w9XPN'></tfoot>
              1. 本文介绍了CommPortIdentifier.getPortIdentifiers 为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在构建一个简单的应用程序,它使用 Java 通信 API javax.comm 通过串行端口进行通信.

                I am building a simple application that communicates through Serial Port using the Java Communication API javax.comm.

                这是我编写的 java main 方法中的一些代码:

                Here is some code in my java main method I wrote:

                CommPortIdentifier cpi = null;
                        Enumeration e = CommPortIdentifier.getPortIdentifiers();
                        while (e.hasMoreElements()) {
                            try {
                                cpi = (CommPortIdentifier) e.nextElement();
                            } catch (NoSuchElementException n) {
                
                            }
                            System.out.println(cpi.getName());
                        }
                

                枚举 e 始终为空,即使我在运行时连接到 COM 4 端口.

                Enumeration e is always empty even though I am connected to a COM 4 port when running this.

                另外,运行此代码:

                portRead = CommPortIdentifier.getPortIdentifier("COM8");
                

                导致 NoSuchPortException

                我认为我已经正确完成了安装部分,并将属性文件、win32com.dll 文件放在了正确的位置.

                I think I have done the installation part correctly and placed the properties file, the win32com.dll file in the right places.

                你知道问题可能是什么吗?

                Do you know what the problem could be?

                谢谢

                推荐答案

                确保win32com.dll(javax.com自带)在jrein目录下.确保 javax.comm.properties(javax.com 附带)在 jdklib 目录中.

                Make sure that win32com.dll (comes with javax.com) is in the jrein directory. Make sure javax.comm.properties (comes with javax.com) is in the jdklib directory.

                这篇关于CommPortIdentifier.getPortIdentifiers 为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:是否有用于访问串行端口的 Java 库或框架? 下一篇:通过串行通信 java 发送数据包

                相关文章

                <legend id='kjoUI'><style id='kjoUI'><dir id='kjoUI'><q id='kjoUI'></q></dir></style></legend>

                <small id='kjoUI'></small><noframes id='kjoUI'>

                  <bdo id='kjoUI'></bdo><ul id='kjoUI'></ul>

                  <tfoot id='kjoUI'></tfoot>
                    <i id='kjoUI'><tr id='kjoUI'><dt id='kjoUI'><q id='kjoUI'><span id='kjoUI'><b id='kjoUI'><form id='kjoUI'><ins id='kjoUI'></ins><ul id='kjoUI'></ul><sub id='kjoUI'></sub></form><legend id='kjoUI'></legend><bdo id='kjoUI'><pre id='kjoUI'><center id='kjoUI'></center></pre></bdo></b><th id='kjoUI'></th></span></q></dt></tr></i><div id='kjoUI'><tfoot id='kjoUI'></tfoot><dl id='kjoUI'><fieldset id='kjoUI'></fieldset></dl></div>