问题
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 :
- Manifest file of JAR that contains VLCLibManager.class updated with proper class-path entries
- My XXX.jar is placed under /lib directory of JNLP. It's getting downloaded correctly
- 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 :
I packed resources that I wanted as a Zip file and placed into /resources directory of my maven project
Maven compiler plugin packs this zip file along with resultant jar.
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