简体   繁体   English

使用相对路径加载jnlp文件

[英]Load jnlp file using relative path

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

..jnlp file in lib of my web project 我的Web项目的lib中的..jnlp文件

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). 它在那里将无法访问,应该将其移动到服务器上浏览器(以及尝试访问它的JWS Client)可用的区域。

Be sure to check the JNLP using JaNeLA, available here . 确保使用JaNeLA检查JNLP,可从此处获得 When loading the JNLP, use the address the end user would use to get it (and not an address on the file system). 加载JNLP时,请使用最终用户用来获取它的地址(而不是文件系统上的地址)。

An applet runs inside a web browser and your jnlp file is still on the web server. 小程序在Web浏览器中运行,并且您的jnlp文件仍在Web服务器上。 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 1.)通过http://yourwebserver.domain/webproject/webcontent/lib/myfile.jnlp访问jnlp文件

2.) Add your jnlp file to your applet.jar and load it with: getClass().getClassLoader().getResourceAsStream("myfile.jnlp"); 2.)将jnlp文件添加到applet.jar并使用以下文件加载: getClass().getClassLoader().getResourceAsStream("myfile.jnlp");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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