java 您如何为浏览器小程序指定特定的 JRE?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/168706/
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-10-29 11:16:21  来源:igfitidea点击:

How do you specify a particular JRE for a Browser applet?

appletjava

提问by rrichter

I have an third-party applet that requires JRE v1.5_12 to work correctly. THe user is installing JRE v1.6.07 or better. It used to be with 1.5 and below, that I could have multiple JRE's on the machine and specify which one to use - but with 1.6 that apepars to be broken. How do I tell the browser I want to use v1.5_12 instead of the latest one installed?

我有一个需要 JRE v1.5_12 才能正常工作的第三方小程序。用户正在安装 JRE v1.6.07 或更高版本。它曾经是 1.5 及更低版本,我可以在机器上有多个 JRE 并指定使用哪个 - 但 1.6 可能会被破坏。如何告诉浏览器我想使用 v1.5_12 而不是安装的最新版本?

回答by davr

For security reasons, you can no longer force it to use older JRE's. Say release 12 has a huge security hole, and everyone installs release 13 to patch it. Evil java applets could just say "run with release 12 please" and then carry out their exploits, rendering the patches useless.

出于安全原因,您不能再强制它使用较旧的 JRE。假设版本 12 有一个巨大的安全漏洞,每个人都安装版本 13 来修补它。邪恶的 Java 小程序可能只是说“请使用第 12 版运行”,然后执行它们的漏洞利用,从而使补丁变得无用。

Most likely you have some code with security holes that the newer JRE is blocking, because it would cause a security risk. Fix your code, should be pretty minor changes, then you wont have to worry.

很可能您有一些带有安全漏洞的代码,新的 JRE 阻止了这些漏洞,因为它会导致安全风险。修复你的代码,应该是很小的改动,然后你就不用担心了。

See this pagefor more info on the change.

有关更改的更多信息,请参阅此页面

回答by Kevin Day

The new applet engine (that will be shipped with 1.6u10 when Sun gets around to officially shipping it) gives you a tremendous amount of control in this area. It's going to take awhile to get enough systems on 6u10 to where you can actually rely on the functionality (unless you are corporate) - but it is coming (seems like it's about 5 years too late).

新的小程序引擎(当 Sun 正式发布 1.6u10 时将随它一起发布)在这方面提供了大量的控制权。需要一段时间才能在 6u10 上获得足够多的系统,让您真正可以依赖这些功能(除非您是公司)——但它即将到来(似乎已经晚了大约 5 年)。

Here's a JavaWorld article describing this at a very high level: article text

这是一篇 JavaWorld 文章,在非常高的层次上对此进行了描述: 文章文本

6u10 also has a deployment toolkit that provides super easy to use javascript snippets that you can include in your applet deployment pages. These snippets handle JRE version checking, user notification, JRE downloading on demand, and a number of other things that are otherwise a hassle (not impossible, just a pain). The deployment kit has been designed to fail gracefully, so it does amazing things if 6u10 or above is installed, and drops back to decent behavior for older JREs.

6u10 还有一个部署工具包,它提供了超级易用的 javascript 片段,您可以将其包含在您的小程序部署页面中。这些片段处理 JRE 版本检查、用户通知、按需下载 JRE 以及许多其他麻烦的事情(并非不可能,只是痛苦)。部署工具包被设计为优雅地失败,因此如果安装了 6u10 或更高版本,它会做出惊人的事情,并且对于较旧的 JRE 会恢复到体面的行为。

One really, really nice thing about the new applet engine is that it runs in a separate process space from the browser. This has a couple of very big advantages, including the ability to have multiple applets running in different versions of the JRE (yes, you can specify different required JREs, including restrictions on how old and how new of JRE you support - the applet engine will re-use JREs if it can, but it has the ability to start up a different one if it needs).

新的小程序引擎的一个非常非常好的事情是它在与浏览器不同的进程空间中运行。这有几个非常大的优势,包括能够在不同版本的 JRE 中运行多个小程序(是的,您可以指定不同的所需 JRE,包括对您支持的 JRE 的新旧程度的限制 - 小程序引擎将如果可以,则重新使用 JRE,但如果需要,它可以启动不同的 JRE)。