运行jnlp时可以访问文件,但在java web start中无法通过浏览器访问文件

发布于 2024-10-04 07:48:20 字数 273 浏览 1 评论 0原文

我正在尝试访问部署在 apache Web 服务器 中的 jar 文件中的资源文件。 该文件可以通过部署文件夹中的 jnlp 文件访问,但在尝试从浏览器访问时无法通过 Web 启动访问。

用于使用 uri 访问文件的代码如下所示:

File helpFile = new File("/myFile.doc");

myFile 位于服务器中部署的应用程序 jar 中。

I'm trying to access a resource file which is in a jar file deployed in apache web server.
The file can be accessed through the jnlp file in the deployed folder while but it is not available through the web start while trying to access from a browser.

The code used to access the file using the uri is something like below :

File helpFile = new File("/myFile.doc");

myFile is in the application jar deployed in the server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长梦不多时 2024-10-11 07:48:20

JNLP 应用程序在您的计算机上本地运行,因此它将具有对 Apache Web 服务器的“文件”访问权限。您必须使用 HttpURLConnection 或任何RESTful 客户端 API 的一部分。

此外,要在服务器上本地访问文件,您必须使用 FileOpenService 不是文件。

A JNLP application is running locally on your machine so it will have 'file' access to the Apache web server. You have to access it with HttpURLConnection or any of the RESTful client API.

Furthermore, to access file locally on your server, you have to use the FileOpenService not File.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文