2

我有一个问题,如何使用 JNLP 协议运行带有参数的 JAR 文件。例如,要正确运行 selenium-server-standalone-2.21.0.jar 包,我将其称为:

selenium-server-standalone-2.21.0.jar -timeout 60000 -trustAllSSLCertificates -port 5555 

当我将这些参数添加为:

<jar href="/selenium-server-standalone-2.21.0.jar -timeout 60000 -trustAllSSLCertificates -port 5555"/>

我收到错误 - 找不到这样的文件。我猜这些参数被视为文件名的一部分,因此我得到了这个错误。我在哪里可以将调用 JAR 包的参数放在下面的 XML 中。

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://test.com/">
<information>
  <title>Selenium-Server-Standalone-2.21.0</title>
  <vendor>ESKY Testers Toolkit</vendor>
  <homepage href="http://www.esky.pl/"/>
  <description>starts selenium server on client machine</description>
</information>
<security>
  <all-permissions/>
</security>
<resources>
  <j2se version="1.4+"/>
  <jar href="/selenium-server-standalone-2.21.0.jar"/>
</resources>
<application-desc main-class="org.openqa.selenium.server.SeleniumServer"/>
</jnlp>
4

1 回答 1

2

添加arg元素作为元素的子application-desc元素。例如

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://test.com/">
<information>
  <title>Selenium-Server-Standalone-2.21.0</title>
  <vendor>ESKY Testers Toolkit</vendor>
  <homepage href="http://www.esky.pl/"/>
  <description>starts selenium server on client machine</description>
</information>
<security>
  <all-permissions/>
</security>
<resources>
  <j2se version="1.4+"/>
  <!-- size.  The downloadable size of the JAR file in bytes. -->
  <jar href="/selenium-server-standalone-2.21.0.jar" size="21247" />
</resources>
<application-desc main-class="org.openqa.selenium.server.SeleniumServer">
    <argument>-timeout</argument>
    <argument>60000</argument>
    <!-- etc... -->
</application-desc>
</jnlp>

以前的评论(现已删除)。

  • 卸载应用程序。在测试新的 JNLP 之前。启动文件可能非常抗更新。事实上,在更改 JNLP 时 - 我通常会更改缓存位置(通过 Java 控制面板)以测试新的启动文件。
  • JNLP。使用JaNaLA检查启动文件的(格式正确和)有效性(除其他外) 。在进行另一项测试之前,更正粉红色/红色的任何错误。
于 2012-05-04T19:39:01.087 回答