使用jnlp.jar在Java中进行文件关联,而没有完整的JWS? [英] File associations in Java using jnlp.jar, without full JWS?

查看:53
本文介绍了使用jnlp.jar在Java中进行文件关联,而没有完整的JWS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java Web Start技术具有

The Java Web Start technology has an IntegrationService API for creating file associations. My question is whether it is possible to somehow use this API (possibly by including jnlp.jar in my app) to create file associations, but without the full Java Web Start technology (no website for the initial installation, the program is distributed with a traditional installer or as a simple executable jar file). The app in question is a desktop/swing app.

(此问题出现在问题如何将文件与Java中的程序相关联)

推荐答案

不需要网站就可以在本地使用jnlp文件,只需使用

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

这将使您可以尝试文件关联,但是您需要进行备份并首先清除Java Preferences缓存.

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

附录:

<?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>

  • <association/> 标签将属性mime-typeextensions用作向JNLP客户端的提示,表明它希望在操作系统中注册为某些扩展名和某些mime类型的主要处理程序." p>

  • 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."

    这篇关于使用jnlp.jar在Java中进行文件关联,而没有完整的JWS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆