简体   繁体   中英

Load jnlp file using relative path

我有一个applet,其init()方法调用一个jnlp文件,该文件下载一个jar。(使用Runtime类和exec('javaws + jnlp的路径)。但是我无法给出jnlp文件的实际路径。我提供jnlp文件的绝对路径时可以提供实际路径的解决方法?

..jnlp file in lib of my web project

It will not be accessible there, and should be moved to an area on the server that is available to a browser (and the JWS Client that is trying to access it).

Be sure to check the JNLP using JaNeLA, available here . When loading the JNLP, use the address the end user would use to get it (and not an address on the file system).

An applet runs inside a web browser and your jnlp file is still on the web server. So you can't access it via file system - even if you have the permission, because it is simply not there. Two possibilities:

1.) Access your jnlp file via http://yourwebserver.domain/webproject/webcontent/lib/myfile.jnlp

2.) Add your jnlp file to your applet.jar and load it with: getClass().getClassLoader().getResourceAsStream("myfile.jnlp");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM