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

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

    1. 用于串行通信的带有 rxtx 组件的 Java 小程序

      时间:2024-08-24

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

        <tfoot id='DxO2V'></tfoot>

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

              • 本文介绍了用于串行通信的带有 rxtx 组件的 Java 小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试构建一个可以打开串行端口并与之通信的小程序.我使用 rxtxcomm.jar 进行串行通信.我构建了一个可以在 eclipese 环境中完美运行的小程序.我构建了 Jar 文件并对其进行了签名,但是在浏览器中运行时,控制台会显示以下内容:

                I am trying to build an applet that can open a serial port and communicate with the same. I have used rxtxcomm.jar for the serial communications. I have an applet built that works in the eclipese environment perfectly. I built the Jar file and signed the same, but when run in the browser the console shows the foll:

                java.lang.ExceptionInInitializerError thrown while loading gnu.io.RXTXCommDriver
                Exception in thread "thread applet-zhas_xbeeComm.xtalk-1" java.lang.ExceptionInInitializerError
                    at zhas_xbeeComm.Xconnect$1.run(Xconnect.java:46)
                    at java.security.AccessController.doPrivileged(Native Method)
                    at zhas_xbeeComm.Xconnect.connect(Xconnect.java:40)
                    at zhas_xbeeComm.xtalk.init(xtalk.java:22)
                    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
                    at java.lang.Thread.run(Unknown Source)
                Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.rxtxSerial)
                    at java.security.AccessControlContext.checkPermission(Unknown Source)
                    at java.security.AccessController.checkPermission(Unknown Source)
                    at java.lang.SecurityManager.checkPermission(Unknown Source)
                    at java.lang.SecurityManager.checkLink(Unknown Source)
                    at java.lang.Runtime.loadLibrary0(Unknown Source)
                    at java.lang.System.loadLibrary(Unknown Source)
                    at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
                    ... 6 more
                

                我什至在 connect 和 open 函数周围使用了 doPrivileged 方法,但它不起作用!请帮忙!!这是小程序的代码片段:{/** 打开一个端口并开始读写的函数 */

                I have even used doPrivileged method around the connect and open functions but it aint working! Please help!! Here is a snippet of the code of the applet: { /** Function to open a port and begin reading and writing */

                public void connect ( final String portName ) throws Exception
                {   
                
                    AccessController.doPrivileged(new PrivilegedAction() {
                    public Object run() {
                        // privileged code goes here, for example:
                
                        // 1. added try catch for no such port exception;
                        try {
                            portIdentifier = CommPortIdentifier.getPortIdentifier(portName); //line 46
                            } catch (NoSuchPortException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                            }
                

                }

                推荐答案

                刚遇到同样的问题.请确保对 RXTX 库的第一次调用是在 doPrivileged 块中.如果它将尝试在特权块之前加载库 - 它将失败并出现此错误.

                Just had the same problem. Please make sure that the first call to RXTX library is in doPrivileged block. If it will try to load library before privileged block - it will fail with this error.

                一些附加信息:http://hacky.typepad.com/blog/2009/05/using-rxtxcomm-in-applets.html

                这篇关于用于串行通信的带有 rxtx 组件的 Java 小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用Java &amp; 的串口通信Eclipse 中的 RXTX 下一篇:Java 串口关闭块

                相关文章

                  <tfoot id='HHb8W'></tfoot>
                1. <legend id='HHb8W'><style id='HHb8W'><dir id='HHb8W'><q id='HHb8W'></q></dir></style></legend>
                2. <small id='HHb8W'></small><noframes id='HHb8W'>

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