JNLP Webstart Launch Issue

試著忘記壹切 提交于 2019-12-25 07:27:16

问题


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");

I already did following :

  1. Manifest file of JAR that contains VLCLibManager.class updated with proper class-path entries
  2. My XXX.jar is placed under /lib directory of JNLP. It's getting downloaded correctly
  3. Have the entry (jar href="lib/XXX.jar"/>>) in XYZ.jnlp file

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


回答1:


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

I did below :

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

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

  3. So I can load the zip file to my java code using

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

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



来源:https://stackoverflow.com/questions/16794711/jnlp-webstart-launch-issue

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