Java Web Start 与嵌入式 Java Applet

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2530380/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 08:53:45  来源:igfitidea点击:

Java Web Start vs Embedded Java Applet

javaappletjava-web-start

提问by Matthew H

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.

我将部署我的 Java 游戏以向我的朋友展示它等等,但是我在 Java Web Start 和小程序之间做出决定时遇到了麻烦。

Under what conditions is one preferable over another and what advantages/disadvantages are there?

在什么条件下一个比另一个更可取,有什么优点/缺点?

采纳答案by Enrique

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.

如果您的游戏将消耗大量 cpu 和内存资源,我建议将其部署为 Java Web Start,因为小程序运行速度较慢。

If you have some java-javascriptinteraction you'd better use applets

如果你有一些java-javascript交互,你最好使用小程序

Hereyou can find a table with advantages/disadvantages

在这里你可以找到一张表的优点/缺点

回答by Tom Hawtin - tackline

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.

我会让它以任何一种方式运行,然后选择使用哪个。小程序将很好地放置在网页中。WebStart 应用程序看起来像一个普通的应用程序(只有一个小三角形表示它来自网络)。从 6u10 开始,applet 可以使用 JNLP 服务,并且可以拖到桌面上。

回答by Jephir

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.

Java 小程序的优点是它们可以立即运行,而无需用户单击任何内容。此外,如果 Java 插件尚未安装,applet 会自动提示浏览器下载 Java 插件。如果您的最终用户不是非常精通技术,这很重要。

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.

但是,applet 的内存(60 - 90 MB)极其有限,因此如果您的游戏使用大量图形,您会注意到性能下降。

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.

如果性能是一个问题,您可能必须使用 Java Web Start。它没有性能损失,但部署起来更棘手,最终用户更难运行。

回答by Paul Clapham

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.

Web Start 要求客户端在他们的计算机上安装 Java 应用程序(可能还有 JRE)。如果他们没有安装软件的管理权限,这将是一个问题。

回答by audriusa

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 bothapplet and web start link? JNLP is not much more difficult to write than the applet tag.

实际上,您可以使用相同的 Java 小程序代码让小程序和 Web 开始。Web start 支持在单独的框架中启动未修改的小程序 .jar,您只需要正确编写 JNLP 文件即可。如果需要,您可以在 JNLP 文件中指定小程序参数。唯一的区别是小程序会在单独的框架中弹出,而不是作为网页的一部分弹出,这可能是也可能不是问题。为什么不提供这两个小应用程序和Web链接的开始?JNLP 并不比 applet 标签难写多少。

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.

我认为 Web 启动和小程序性能之间应该没有太大区别,除非小程序在作为浏览器一部分的某些旧 JRE 中运行。无论如何我都不会推荐这个 - 与任何其他软件一样,Java 会随着时间的推移而发展并变得更好。这可能解释了那些谈论 Web 启动应用程序要快得多的帖子,否则这将很难理解。如果您的小程序也支持旧的 JRE,我认为您可以简单地在 JNLP 中指定低版本号,添加 + 以便它也可以在未来版本中运行。

回答by Vanuan

Since Oracle is not making any progress in delivering a non-NPAPI java plugin, I would say that applets is an obsolete technology.

由于 Oracle 在提供非 NPAPI java 插件方面没有取得任何进展,我会说小程序是一种过时的技术。

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.

否则,我们将潜入一个很好的旧 IE 网页。银行已经需要 IE 浏览器,这样他们就不会花费大量资金来更新他们的软件。我为他们感到难过。