有没有办法可以在我的服务器中添加 Java Web Start 服务,该服务使用我自己的基于 TCP 的协议?

发布于 2024-09-24 22:13:39 字数 226 浏览 1 评论 0原文

我正在用 Java 构建一个应用程序,随着时间的推移,它会进行一些更新。这意味着客户端必须下载新的 .jar 并在可用时使用它。 我读到了 jws(java web start),它工作得很好。但问题是我的应用程序使用我创建的协议,它只能连接到我的服务器。它可能没有连接到互联网,我不应该能够在该服务器上安装网络服务器。 那么有没有办法可以在我自己的原型中使用 JNLP 呢?或者我必须自己做这一切?让它下载一个新的 jar 并删除旧的?

I am building an applicaton in Java that will have some updates over time. This means that the client will have to download a new .jar and use it when available.
I read about jws (java web start) and it works fine. But the problem is that my application uses a protocol I created, and it will just be able to connect to my server. It may not have connectin to internet and I should not be able install a web server on that server.
So is there a way I can use JNLP inside my own proto? Or I will have to do it all by myself?? Making it download a new jar and deleting the old one?

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

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

发布评论

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

评论(2

梅窗月明清似水 2024-10-01 22:13:39

如果您的应用程序基于Web Start,它将自动执行更新。然而,这仅适用于已知协议,例如 HTTP(也可能是 FTP,但从未尝试过)。我认为您不会让 Web Start 使用您自己的协议,但您可以尝试使用自定义 URLConnectionFactory 来实现,并为您的协议推出您自己的连接处理程序。请参阅 java.net.URL.setURLStreamHandlerFactory(URLStreamHandlerFactory)

无论如何,在这种情况下我会使用自定义更新实现,因为您的要求似乎非常具体。因为您的应用程序似乎并不基于具有更新机制的现有框架(例如带有 P2 管理器的 Eclipse RCP 或 NetBeans 或 Java 插件框架或 Maven ...)。

If your application is based on Web Start, it will automatically perform the updates. However, this only works for known protocols, such as HTTP (and maybe FTP, but never tried that). I don't think you will get Web Start working with your own protocol, but you could try to do it with a custom URLConnectionFactory and roll your own connection handler for your protocol. See java.net.URL.setURLStreamHandlerFactory(URLStreamHandlerFactory)

Anyway, I'd go with a custom update implementation in this case, as you requirements seem to be very specific. Since your app doesn't seem to be based on an existing framework with update mechanisms (e.g. Eclipse RCP with P2 manager or NetBeans or Java Plugin Framework or Maven ...).

柳若烟 2024-10-01 22:13:39

问题是如何将启动应用程序所需的文件下载到 Java WebStart,如果您拥有的只是专有协议,那么运行 Java WebStart 的计算机上没有任何可以与该协议通信的内容,因此您无法获取下载的任何东西。

换句话说,您需要一个 Web 服务器才能使 Java WebStart 正常工作。

(如果没有服务器,我不认为“为 JWS 缓存播种”是一个可行的选择)

但是,您可以轻松创建一个 Google 应用程序引擎应用程序,它可以为您的应用程序提供文件,并且< /em> 对于 Java WebStart 来说就足够了(加上一些配置,允许程序知道在哪里联系您的应用程序)。

The problem is how to get the files needed to start your application downloaded to Java WebStart, and if all you have is your proprietary protocol, then you don't have anything on the machine running Java WebStart which can talk the protocol so you cannot get anything downloaded.

In other words, you need a web server somewhere for Java WebStart to work well.

(I do not consider the "seed the JWS cache" to be a viable option if there is no server)

You can, however, easily create a Google Application Engine application which can provide the files for your application, and that is enough for Java WebStart (plus enclose some configuration that allows for the program to know where to contact your application).

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