JNLP文件的本地替代? [英] Local alternative to JNLP file?

查看:171
本文介绍了JNLP文件的本地替代?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽我所能,我无法在本地运行JNLP文件(通过双击)。这似乎是一个定位jar文件的问题,即使我相对于jnlp文件指定它也是如此。我收到以下错误:

Try as I might, I can't get a JNLP file to run locally (via a double-click). It seems to be an issue of locating a jar file, even when I specify it relative to the jnlp file. I get the following error:


字段< jar> href的
值无效:helloworld.jar

The field <jar>href has an invalid value: helloworld.jar

即使JNLP文件与helloworld.jar位于同一文件夹中,也会发生这种情况。我已经完成了搜索,这是一个一致的问题,特别是对于想要在CD上打包应用程序并使用JNLP的人。 Sun提供的唯一解决方案是通过命令行指定代码库的能力,但这并没有多大帮助。我不明白他们为什么不假设或允许代码库为。或file://。 - 我在jnlp标记的codebase参数中尝试了这些类型的东西(文件内部)并没有任何效果。

This happens even when the JNLP file is in the same folder as helloworld.jar. I've done searches and this is a consistent problem especially for people who want to package an application on a CD and use JNLP. The only Sun-provided "solution" is the ability to specify the codebase via command line, but that doesn't really help much. I don't understand why they don't assume or allow the codebase to be "." or "file://." - I tried these sorts of things in the codebase parameter of the jnlp tag (inside the file) and nothing worked.

使用JNLP文件非常方便,因为我不需要担心平台检测,本机库,甚至主要的JOGL jar文件;我只是包含这一行,一切都为我完成:

It is extremely convenient for me to use a JNLP file because I don't need to worry about platform detection, native libraries, or even the main JOGL jar files; I simply include this line and everything is done for me:

<extension name="JOGL" href="http://download.java.net/media/jogl/builds/archive/jsr-231-2.0-beta10/webstart/jogl-all-awt.jnlp" />

我希望找到能做同样事情的事情。如果没有,我可以手动(或使用Ant)抓取JOGL jar文件,这不是什么大问题;这只是JNLP为我做的事情之一,我真的很想念。

I'm hoping to find something that can do the same sort of thing. If not, I can manually (or with Ant) grab the JOGL jar files, it's not a big deal; just one of those things that JNLP does for me and I'm really going to miss.

什么是JNLP文件的最佳替代方案,让我在本地使用(即双击运行)?有什么优雅或我只需要为Linux编写一个shell脚本,Windows的批处理文件,并让Ant检测并下载相应的JOGL jar?

推荐答案

我使用了这样的.jnlp文件在本地启动Java Web Start软件

I've used a .jnlp file like this to launch Java Web Start software locally


  1. 像这样指定代码库:
    < jnlp spec =1.0+codebase =file:// localhost / X:/ path / to / jnlp / href =software.jnlp>

列出具有相对路径的资源:< resources> ;
< jar href =lib / software.jarmain =true/>
< jar href =lib / softwareLibrary.jarmain =true/>
...
< / resources>

list resources with relative paths: <resources> <jar href="lib/software.jar" main="true" /> <jar href="lib/softwareLibrary.jar" main="true" /> ... </resources>

最后告诉Web Start它可以找到的地方标有 main =true的jar中的软件入口点< application-desc main-class =com.example.Main />

and finally tell Web Start where it can find the software entry point inside the jar marked with main="true": <application-desc main-class="com.example.Main" />

远程部署时唯一需要改变的是代码库参数。

The only thing you need to change when deploying remotely is the codebase parameter.

这篇关于JNLP文件的本地替代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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