gpt4 book ai didi

java - JNLP 文件关联 : How do I open the file which was double-clicked on?

转载 作者:行者123 更新时间:2023-11-29 07:22:00 25 4
gpt4 key购买 nike

我有以下 JNLP:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0.10//EN" "http://java.sun.com/dtd/JNLP-6.0.10.dtd">
<jnlp spec="6.0.10" version="1.63" codebase="http://foo.example.com/msi" href="Foo.jnlp">
<information>
<title>Foo</title>
<vendor> Foo Systems, Inc.</vendor>
<homepage href="http://Foo.com"/>
<description>Foo Viewer/Editor Application</description>
<icon href="splash.gif" width="425" height="102" kind="splash"/>
<icon href="Foo.gif" width="64" height="64"/>
<offline-allowed/>
<shortcut>
<desktop/>
<menu submenu="Foo Systems, Inc."/>
</shortcut>
<association mime-type="application-x/wlog" extensions="wlog"/>
<association mime-type="application-x/mplot" extensions="mplot"/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" initial-heap-size="32m" max-heap-size="255m"/>
<jar href="jars_deployment/TimingFramework-1.0.jar"/>
<jar href="jars_deployment/iText-2.1.5.jar"/>
<jar href="jars_deployment/jai_codec.jar"/>
<jar href="Foo.jar"/>
<jar href="jars_deployment/TimingFramework-1.0.jar"/>
<jar href="jars_deployment/iText-2.1.5.jar"/>
<jar href="jars_deployment/jai_codec.jar"/>
<jar href="jars_deployment/jsch-20090402.jar"/>
<property name="apple.laf.useScreenMenuBar" value="true"/>
<property name="apple.awt.graphics.UseQuartz" value="false"/>
<property name="com.apple.mrj.application.apple.menu.about.name" value="Foo"/>
<property name="java.util.logging.config.file" value="/Users/Shared/logging.properties"/>
</resources>
<application-desc main-class="com.prosc.msi.editor.ui.test.Sandbox"/>
</jnlp>

几乎一切正常。当我双击 .wlog 文件时,它会打开我的应用程序。但是,它不会打开正确的文件。我在某处读到 JNLP 应该将参数传递给 main 方法,指示哪个文件导致应用程序启动,但这并没有发生(在 OS X 10.6 上)。我的应用程序的 main 方法得到一个空数组。

可能无关,我的启动画面不工作:(

有什么建议可以让它正常工作吗?

最佳答案

在 Mac OS X 上的捆绑应用程序中,您可以实现 com.apple.eawt.ApplicationListener ,如 Mac OS X 引用库 示例所示,OSXAdapter :

The sample also supports document handing from the Finder by implementing the handleOpenFile() method and registering for supported file types in its Info.plist file.

附录:com.apple.eawt.ApplicationListener已弃用;而是考虑 com.apple.eawt.Application ,它提供了 getApplication().setOpenFileHandler()

关于java - JNLP 文件关联 : How do I open the file which was double-clicked on?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2878914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com