简体   繁体   English

我可以从 Java 应用程序中删除下载的 JNLP 文件(Java web start/JWS)吗?

[英]Can I delete downloaded JNLP file (Java web start/JWS) from Java application?

Google Chrome does not launch JNLP file automatically, so I recommend for our users this solution .谷歌浏览器不会自动启动 JNLP 文件,所以我向我们的用户推荐这个解决方案 It works but the downloaded JNLP file remains in download folder.它可以工作,但下载的 JNLP 文件仍保留在下载文件夹中。 Deleting them manually is troublesome.手动删除它们很麻烦。

I want to add a function to our Java application:我想向我们的 Java 应用程序添加一个函数:

  1. Google Chrome downloads a JNLP file and open it.谷歌浏览器下载一个 JNLP 文件并打开它。
  2. The JNLP file starts our Java application. JNLP 文件启动我们的 Java 应用程序。
  3. The Java application deletes the JNLP file (<= I want this function!) Java 应用程序删除 JNLP 文件(<= 我想要这个函数!)

Can I get the file path of the downloaded JNLP file which started the Java application?我可以获取已下载的启动 Java 应用程序的 JNLP 文件的文件路径吗? Of cause, our Java application jar is signed and can access local resources.当然,我们的 Java 应用程序 jar 已签名并且可以访问本地资源。

There is nothing in the Java WebStart paper that describes such a mechanism, hence you are in "vendor-specific" territory, and I do not think that there is an API letting your application know where the JNLP file is. Java WebStart 论文中没有任何内容描述这种机制,因此您处于“特定于供应商”的领域,我认为没有 API 可以让您的应用程序知道 JNLP 文件的位置。

You can, however, provide a replacement for javaws which invoke the original javaws with -wait and delete the JNLP file afterwards.但是,您可以提供 javaws 的替代品,它使用 -wait 调用原始 javaws,然后删除 JNLP 文件。 This must be installed by the user.这必须由用户安装。

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

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