问题
My team uses a lot of Java applications and applets (both internally created and from external sources).
Since the release of Java 7, which we are using for some applications, we have found a number of problems with external applications and applets which do not support Java 7 (although I don't know why - however, having spoken to the tech support at the organisations that provide these applications, they indicate that their applications are not compatible with Java 7).
Unfortunately, many of these applications state that they work on any (recent) version of Java (e.g. 1.5+). Obviously, it would be nice if the providers of these applets and applications would amend their code to specify which version of Java they can work on, rather than stating they can work with versions that they don't. However, what can I do in the interim?
Webstart Applications:
For these I create a batch file specifying which version of the JRE to use e.g.:
C:/"Program Files"/Java/jre6/bin/javaws http://www.website.com/path/to/app.jnlp
Is there a better way of doing this?
Web Applets:
I've not had any success with specifying for web applets. I know I could specify the JRE version for Internet Explorer (e.g. this question), but I don't want to force all web applets to use an old version of Java - I only want to specify on a case by case basis.
I had contemplated creating a batch file that would launch internet explorer with a particular JRE specified... something along the lines of
start iexplore [specify JRE] http://www.website.com/pageWithWebApplet.html
...but I don't know how to specify the JRE. Any ideas?
Alternatively, if there are better ways of doing this, I would love to know.
回答1:
For an applet, you could try saving the page the applet is in, plus its JNLP file, edit the JNLP file to change version="1.6+"
to version="1.6"
(or whatever), change the HTML file so the applet points to the local version of the JNLP file but everything else points to the original site, put the modified files up on your intra-net, and point your web browsers at your intra-net's page when you want to use the applet. Since the applet's codebase still will be on the external website instead of on your intranet, untrusted applets will still be able to make network connections back to their originating host.
Of course, this assumes that the external website allows the relevant files to be downloaded when the HTTP referer isn't their site (that is, it allows "hotlinking" of its resources).
来源:https://stackoverflow.com/questions/7258998/managing-upgrades-to-java-7