File associations in Java using jnlp.jar, without full JWS?

我的梦境 提交于 2019-12-02 09:54:39
trashgod

No web site is required to use a jnlp file locally, just use a file URI scheme for the jnlp codebase and jar href.

This will let you experiment with file associations, but you'll want to do a backup and clean the Java Preferences cache first.

Addenda:

  • As a concrete example, this jnlp launches JFreeChart:

    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" 
            codebase="file:///Users/trashgod/jnlp/"
            href="jfreechart-1.0.14-demo.jnlp">
        <information>
            <title>JFreeChart 1.0.14 Demo</title>
            <vendor>Object Refinery Ltd</vendor>
            <homepage href="http://www.object-refinery.com/" />
            <description>A demo for the JFreeChart class library</description>
            <description kind="short">JFreeChart demo application.</description>
            <description kind="tooltip">JFreeChart 1.0.14 Demo</description>
            <offline-allowed />
        </information>
        <resources>
            <j2se version="1.5+" initial-heap-size="12m" max-heap-size="256m" />
            <jar href="file:///opt/jfreechart/jfreechart-1.0.14-demo.jar" />
            <jar href="file:///opt/jfreechart/lib/jcommon-1.0.17.jar" />
            <jar href="file:///opt/jfreechart/lib/jfreechart-1.0.14.jar" />
        </resources>
        <application-desc main-class="demo.SuperDemo" />
    </jnlp>
    
  • The <association/> tag uses the attributes mime-type and extensions as "a hint to the JNLP client that it wishes to be registered with the operating system as the primary handler of certain extensions and a certain mime-type."

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!