Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.(注意:本文中的建议仅适用于JxBrowser6,JxBrowser7相应文章请点击这里。)


This section describes how you can deploy your Java application with JxBrowser library via Java Web Start (JWS). To deploy your application via JWS, please follow the following steps:(本节描述如何通过Java Web Start(JWS)使用JxBrowser库部署Java应用程序。要通过JWS部署应用程序,请遵循以下步骤:)



1. Pack your application classes into an application JAR file(s). For example myapp.jar.(1.将应用程序类打包到应用程序JAR文件中。例如myapp.jar。)



2. Sign all JAR files used in your application (including all JxBrowser JARs and the license JAR file) with a valid signature. To sign JAR files you can use the jarsigner tool. For example.(2.使用有效签名对应用程序中使用的所有JAR文件(包括所有JxBrowser JAR和许可证JAR文件)进行签名。要签名JAR文件,可以使用jarsigner工具。例如。)

jarsigner -keystore keystore_file -storepass storepass
    -keypass keypass myapp.jar alias

Note: make sure that you replace keystore_file, storepass, keypass, and alias with your own values.(注意:请确保将keystore_file,storepass,keypass和别名替换为您自己的值。)

Note: JxBrowser JAR files are not signed, so you need to sign them with the same signature you use for signing your application JAR files.(注意:JxBrowser JAR文件未签名,因此您需要使用与对应用程序JAR文件签名相同的签名对其进行签名。)


3. Create and configure your application JNLP file (e.g. myapp.jnlp) as described below:(3.如下所述创建和配置您的应用程序JNLP文件(例如myapp.jnlp):)

<jnlp spec="1.6+" codebase="my_url" href="myapp.jnlp">
    <information>
        <title>My Application</title>
        <vendor>My Company</vendor>
        <description>My Application Description</description>
        <offline-allowed/>
    </information>

    <security>
        <all-permissions/>
    </security>

    <resources>
        <j2se version="1.6+"/>
        <jar href="lib/myapp.jar"/>
        <jar href="lib/jxbrowser.jar" />
        <jar href="lib/license.jar" />
    </resources>

    <resources os="Windows">
        <jar href="lib/jxbrowser-win32.jar" />
        <jar href="lib/jxbrowser-win64.jar" />
    </resources>

    <resources os="Mac OS X">
        <jar href="lib/jxbrowser-mac.jar" />
    </resources>

    <resources os="Linux" arch="x86_64 amd64">
        <jar href="lib/jxbrowser-linux64.jar" />
    </resources>
</jnlp>

Note: make sure that you replace codebase attribute value with a valid URL address of your web server where JAR files will be located.(注意:请确保将代码库属性值替换为将要放置JAR文件的Web服务器的有效URL地址。)


Depending on the network speed it might take some time to download all JxBrowser JAR files. To speed up start up time of your Java Web Start application you might want to use the download="lazy" attribute of the jar element.(根据网络速度,下载所有JxBrowser JAR文件可能需要一些时间。为了加快Java Web Start应用程序的启动时间,您可能需要使用jar元素的download =“ lazy”属性。)


4. Upload all signed JAR files and the myapp.jnlp file to a web-server.(4.将所有签名的JAR文件和myapp.jnlp文件上传到Web服务器。)


Java 9 and higher(Java 9及更高版本)

On Java 9, Java Web start sets the --illegal-access=deny VM parameter by default.  However, in order to work correctly, your Java Web start application should be run with the  --illegal-access=permit VM parameter. Otherwise you will be getting the IllegalAccessError. This is a known limitation, as JxBrowser support Java 9 with some limitations (more  details  here ).  (在Java 9上,默认情况下,Java Web start设置--illegal-access = deny VM参数。但是,为了正常工作,您的Java Web Start应用程序应使用--illegal-access = permit VM参数运行。否则,您将收到IllegalAccessError。这是一个已知的限制,因为JxBrowser支持Java 9并具有一些限制(此处有更多详细信息)。)

Unfortunately, Java Web Start does not support the  --illegal-access=permit VM parameter. JNLP applications that need to break encapsulation should use the precise options, like  --add-exports and  --add-opens (不幸的是,Java Web Start不支持--illegal-access = permit VM参数。需要中断封装的JNLP应用程序应使用精确的选项,例如--add-exports和--add-opens。)


The solution is adding the following line to your JNLP file: (解决方案是将以下行添加到您的JNLP文件中:)

java-vm-args="--add-opens=java.base/java.util=ALL-UNNAMED--add-exports=java.desktop/sun.awt=ALL-UNNAMED