• <bdo id='0hUnj'></bdo><ul id='0hUnj'></ul>

        <small id='0hUnj'></small><noframes id='0hUnj'>

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

      1. <tfoot id='0hUnj'></tfoot>

      2. 当端口存在时,为什么我会收到 Java NoSuchPortException?

        Why am I getting a Java NoSuchPortException when the port exists?(当端口存在时,为什么我会收到 Java NoSuchPortException?)
            <bdo id='50kSG'></bdo><ul id='50kSG'></ul>

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

            • <small id='50kSG'></small><noframes id='50kSG'>

                <tbody id='50kSG'></tbody>
              <tfoot id='50kSG'></tfoot>

                  本文介绍了当端口存在时,为什么我会收到 Java NoSuchPortException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  得到以下生产代码,我正在将其用于新驱动程序.portName 是 COM4 并且这个端口存在于 PC 上(我可以通过超级终端连接到它),那么为什么 Javacomm 会抛出 NoSuchPortException 呢?COM4 在设备管理器中显示良好.太

                  Got the following production code below, I'm using it for a new driver. portName is COM4 and this port exists on the PC (and I can connect to it with hyperterminal), so why does Javacomm throw a NoSuchPortException? COM4 shows up fine in device mgr. too

                      final String portName = getSerialPort();
                      try {
                          final CommPortIdentifier id = CommPortIdentifier.getPortIdentifier(portName);
                          port = (SerialPort) id.open(getName(), 1000);
                      } catch (NoSuchPortException nspe) {
                          report(SeverityCode.LEVEL2, getName(), "PIN Pad is not connected to " + portName + " port, or the port does not exist.");
                          return;
                      } catch (PortInUseException piue) {
                          report(SeverityCode.LEVEL2, getName(), portName + " port is already in-use by some other device. Reason: " + piue.getMessage());
                          return;
                      }
                  

                  推荐答案

                  尝试使用 CommPortIdentifier.getPortIdentifiers() 枚举系统上可用的端口列表并打印列出的内容.您确定将 jarfiles 和 dll 安装在正确的文件夹中吗?如果是,则尝试使用 CommPortIdentifier.addPortName(java.lang.String portName, int portType, CommDriver driver) 添加 COM4.您可以将驱动程序参数设置为 null 以使用默认驱动程序.

                  Try enumerating the list of ports that are available on your system using the CommPortIdentifier.getPortIdentifiers() and print what's listed. Are you sure that you installed the jarfiles and dll in the correct folders? If yes, then try adding COM4 using CommPortIdentifier.addPortName(java.lang.String portName, int portType, CommDriver driver) .You can set the driver parameter to null to use the default driver.

                  这篇关于当端口存在时,为什么我会收到 Java NoSuchPortException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                    • <tfoot id='q4ZL1'></tfoot>

                        <bdo id='q4ZL1'></bdo><ul id='q4ZL1'></ul>
                            <tbody id='q4ZL1'></tbody>

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

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