0

I am developing a Web page using jsp and html where in I need to read/write from/to a Device connected on Client's System who are accessing the Webpage. The Device is a Serial Device which is connected as COM1(Eg) in Windows. I went through different options available. I found this which serves my purpose. I started learning JNLP for the same. I imported the project and made changes according to my needs. (This project is using jssc.jar). I generated the jar (jSSC-Terminal.jar) and signed with self-generated key. The GUI is being loaded properly but I am unable to access the Serial port on client's machine. Here is my jnlp file launch.jnlp

   <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp href="launch.jnlp" spec="1.0+"   codebase="http://192.168.1.33:8080/abc" 
    href="launch.jnlp">
    <information>
        <title>jSSC-Terminal</title>
        <vendor>scream3r</vendor>
        <homepage href="scream3r.org"/>
        <description>jSSC-Terminal</description>
        <description kind="short">jSSC-Terminal</description>

    </information>
<update check="background"/>
<security>
<all-permissions/>
</security>
    <resources>
<j2se version="1.5+"/>
<jar href="jSSC-Terminal.jar" main="true"/>

<jar href="jssc.jar" download="eager"/>



</resources>
    <applet-desc height="500" main-class="applet.Main" name="Main" width="700">

    <param name="separate_jvm" value="true"/>
<param name="draggable" value="true"/>
</applet-desc>
</jnlp>

Here is my html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
          <title>jSSC-Terminal</title>
            <style type="text/css">
              body {
                margin-left: 10px;
                margin-top: 10px;
                margin-right: 10px;
                margin-bottom: 10px;
              }
        </style>
        </head>
  <body>
  <applet code="applet.Main" archive="http://192.168.1.33:8080/abc/jSSC-Terminal.jar, http://192.168.1.33:8080/amar/lib/jssc.jar" width="700" height="500">
      <param name="separate_jvm" value="true"/>
      <param name="draggable" value="true"/>
          </applet>
        </body>
</html>

I have placed all these files in Tomcat directory as below

/Tomcat/webapps/abc/launch.jnlp
/Tomcat/webapps/abc/jSSC-Terminal.jar
/Tomcat/webapps/abc/index.html
/Tomcat/webapps/abc/lib/jssc.jar

I am unable to get the SerialPort List when run as jnlp. Kindly help me out with a fix if available. Or are there any alternate things available in JSP. Thanks and Regards.

Edit :

Finally found out thank you. I replaced my applet tag and included jnlp location as below :

<applet code="applet.Main" archive="http://192.168.1.33:8080/abc/jSSC-Terminal.jar,    http://192.168.1.33:8080/abc/lib/jssc.jar,"http://192.168.1.33:8080/abc/test.jnlp" width="700" height="500">
      <param name="separate_jvm" value="true"/>
      <param name="draggable" value="true"/>
          </applet>
        </body>
4

1 回答 1

0

您的<applet>标签不引用 .jnlp 文件。您可以访问 jnlp 文件中的 COM 端口,但它没有被使用。您必须使用 jnlp 文件或在<applet>标签中设置权限。

您指向 jssc 示例的链接是一个页面,该页面显示了如何使用<applet>标记中的 jnlp 文件。

我已经完成了您尝试使用 Java Webstart 应用程序和PureJavaComm库所做的事情。不过,我敢打赌,一旦您获得正确的权限,您正在做的事情就会奏效。但是,如果您想看看我是如何设置它的 jnlp 文件在这里:https ://bitminter.com/client/bitminter.jnlp (实时应用程序)

于 2014-11-12T21:00:12.197 回答