Java Web Start 与嵌入式 Java Applet
我将部署我的 Java 游戏以向我的朋友展示它等等,但我在 Java Web Start 和 applet 之间做出选择时遇到了困难。
在什么条件下,一种优于另一种?有哪些优点/缺点?
I'm going to deploy my Java game to show it to my friends and whatnot, but I'm having trouble deciding between Java Web Start and applets.
Under what conditions is one preferable over another and what advantages/disadvantages are there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
实际上,您可以使用相同的 Java applet 代码来启动 applet 和 web。 Web start 支持在单独的框架中启动未修改的 applet .jar,您只需正确编写 JNLP 文件即可。如果需要,您可以在 JNLP 文件中指定小程序参数。唯一的区别是小程序将在单独的框架中弹出,而不是作为网页的一部分,这可能是也可能不是问题。为什么不同时提供小程序和网络启动链接? JNLP并不比applet标签难写多少。
我认为 Web 启动和 applet 性能之间应该没有太大差异,除非 applet 在作为浏览器一部分的某些旧 JRE 中运行。无论如何,我不会推荐这个 - 与任何其他软件一样,Java 会随着时间的推移而发展并变得更好。这可以解释那些谈论 Web 启动应用程序要快得多的帖子,否则将很难理解。如果你的小程序也支持旧的JRE,我想你可以简单地在JNLP中指定低版本号,添加+,这样它也可以在未来的版本中运行。
You can actually have both applets and web start with the same Java applet code. Web start supports launching unmodified applet .jar in a separate frame, all you need is to write JNLP file properly. You can specify the applet parameters in JNLP file, if required. The only difference is that the applet will pop out in a separate frame and not as part of the web page which may or may not be a problem. Why not to provide both applet and web start link? JNLP is not much more difficult to write than the applet tag.
I think it should not be much difference between Web start and applet performance unless applet runs in some old JRE that is part of the browser. I would not recommend this anyway - as any other software, Java evolves and gets better over time. This may explain posts talking about that Web start application is much faster, this otherwise would be very difficult to understand. If you applet supports also old JREs, I think you can simply specify the low version number in JNLP, adding + so it can also run with future versions.
由于 Oracle 在提供非 NPAPI java 插件方面没有取得任何进展,因此我认为 applet 是一项过时的技术。
否则,我们就会陷入一个只有 IE 的旧式网络。银行已经要求使用 IE 浏览器,这样他们就不会花费大量资金来更新他们的软件。我为他们感到难过。
Since Oracle is not making any progress in delivering a non-NPAPI java plugin, I would say that applets is an obsolete technology.
Otherwise, we would dive into a good old IE-only web. Banks are already requiring IE browsers so they would not spend tons of money to modernize their software. I feel sorry for them.
Web Start 要求客户端在其计算机上安装 Java 应用程序(可能还有 JRE)。如果他们没有安装软件的管理权限,这将是一个问题。
Web Start requires the client to install the Java application (and possibly the JRE) on their computers. If they don't have administrative rights to install software this is going to be a problem.
如果您的游戏将消耗大量 CPU 和内存资源,我建议将其部署为 Java Web Start,因为小程序运行速度较慢。
如果您有一些 java-javascript 交互,您最好使用小程序
在这里您可以找到一个包含优点/缺点的表格
If your game is going to consume a lot of cpu and memory resources I recommend deploying it as Java Web Start since applets run slower.
If you have some java-javascript interaction you'd better use applets
Here you can find a table with advantages/disadvantages
Java 小程序的优点是它们可以立即运行,而无需用户单击任何内容。此外,如果尚未安装Java 插件,小程序会自动提示浏览器下载该插件。如果您的最终用户不太精通技术,这一点很重要。
然而,小程序的内存非常有限(60 - 90 MB),因此如果您的游戏使用大量图形,您会注意到性能下降。
如果性能是一个问题,您可能必须使用 Java Web Start。它不会造成性能损失,但部署起来要困难得多,而且最终用户运行起来也更困难。
Java applets have the advantage that they run instantly without the user having to click on anything. In addition, applets will automatically prompt the browser to download the Java plug-in if it's not already installed. This is important if your end users aren't very tech-savvy.
However, applets are extremely limited in terms of memory (60 - 90 MB), so if your game uses a lot of graphics you will notice a performance slowdown.
If performance is an issue, you will probably have to use Java Web Start. It suffers no performance penalty, but is a lot trickier to deploy and more difficult for end users to run.
我会让它作为其中之一运行,然后选择使用哪个。小程序可以很好地放置在网页中。 WebStart 应用程序看起来就像一个普通的应用程序(只有一个小三角形表明它来自网络)。从6u10开始,小程序可以使用JNLP服务,并且可以拖到桌面上。
I'd make it run as either, and then choose which to use. An applet will sit in a web page nicely. A WebStart application will look like a normal application (only with a little triangle to indicate it's from the web). From 6u10, applets can use JNLP services, and can be dragged out on to the desktop.