JNLP Webstart启动问题 [英] JNLP Webstart Launch Issue

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

问题描述

我需要将Jar文件的内容动态提取到本地目录.应用程序的其余部分将使用这些内容.在我的日食开发环境中,一切工作正常.但是,在进入JNLP启动时,遵循以下代码安逸性会返回null.

I have a requirement to dynamically extract the content of a Jar file to a local directory. Remaining part of application will use these content. Everything working well in my eclipse development environment. However following peace of code returns null when it comes into JNLP launch.

InputStream stream =  VLCLibManager.class.getClass().getClassLoader().getSystemResourceAsStream("XXX.jar");

我已经做到了:

  1. 包含VLCLibManager.class的JAR清单文件已使用正确的类路径条目进行了更新
  2. 我的XXX.jar放在JNLP的/lib目录下.正确下载了
  3. 在XYZ.jnlp文件中具有条目(jar href ="lib/XXX.jar"/>>)

在过去的几天里,我一直困扰于此问题,对此有任何帮助.

Any help appreciated as I'm stucked with this issue for the past few days.

推荐答案

最后,我解决了该问题.在这里发表文章的想法是,它可以帮助面临类似问题的其他人.

Finally I resolved the issue. Thought of publishing here as it would help others who face similar issue.

我在下面做了:

  1. 我将所需的资源打包为Zip文件,并放置到我的Maven项目的/resources目录中

  1. I packed resources that I wanted as a Zip file and placed into /resources directory of my maven project

Maven编译器插件将此zip文件与生成的jar打包在一起.

Maven compiler plugin packs this zip file along with resultant jar.

因此我可以使用

YourClass.class.getResourceAsStream("/XXXX.zip")

YourClass.class.getResourceAsStream("/XXXX.zip")

这会将资源加载到Java程序.您可以根据需要解压缩并在需要的地方使用

This loads resources to java program. You can unzip as you wanted and use it whereever needed

这篇关于JNLP Webstart启动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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