简体   繁体   English

用Java 6 JRE而不是JRE 7打开JNLP文件

[英]Opening JNLP File in Java 6 JRE instead of JRE 7

I have Java 6-based Java Web Start application that I need to open on a Windows machine. 我有一个基于Java 6的Java Web Start应用程序,我需要在Windows机器上打开它。 The machine has JRE 7 installed, with JRE 6 copied manually to the Program Files folder. 机器安装了JRE 7,手动将JRE 6复制到Program Files夹。 The problem is that whenever I want to open the JWS application, it opens using Java 7. Even if I use the javaws executable from JRE 6, some properties still refer to JRE 7 files (I verified this by using javaws -verbose app.jnlp . How can I force JRE 6 just for this application? 问题在于每当我想打开JWS应用程序时,它都会使用Java 7打开。即使我使用JRE 6中的javaws可执行文件,一些属性仍然引用JRE 7文件(我使用javaws -verbose app.jnlp验证了这javaws -verbose app.jnlp我如何才能为这个应用程序强制使用JRE 6?

I have Java 6-based Java Web Start application ..How can I force JRE 6 just for this application? 我有基于Java 6的Java Web Start应用程序..如何才能为此应用程序强制使用JRE 6?

Use an appropriate version attribute in the j2se element. j2se元素中使用适当的version属性。

<resources>
    <!-- Any 1.6 JRE -->
    <j2se version='1.6*'>
    ...
</resources> 

Warning 警告

This solution no longer seems to work for installing earlier versions of the JVM! 此解决方案似乎不再适用于安装早期版本的JVM!

The best reason I can think of for why it would fail to work is that Oracle is tiring of releasing security updates for earlier Java versions - so is forcing every user to use the latest JVM. 我能想到它为什么不能工作的最好理由是Oracle厌倦了为早期Java版本发布安全更新 - 因此迫使每个用户使用最新的JVM。

I realize this is the oldest post ever, but it came up when I searched for a similar problem. 我意识到这是有史以来最古老的帖子,但是当我搜索类似的问题时,它就出现了。 Easiest way to deal with this (as a one time solution that won't affect the system overall) is to install a parallel older version of Java, and drag the jnlp on to the javaws.exe. 处理此问题的最简单方法(作为一个不会影响整个系统的一次性解决方案)是安装并行的旧版Java,并将jnlp拖到javaws.exe上。 (I had a web app that used Java 5 and wouldn't open otherwise) (我有一个使用Java 5的Web应用程序,否则不会打开)

I have an UAC controlled laptop with Windows 7 and two Java versions installed (1.8 and 1.7). 我有一台UAC控制的笔记本电脑,安装了Windows 7和两个Java版本(1.8和1.7)。 The sesWebstart.jnlp has to be started with the older Java version, in my case 1.7. sesWebstart.jnlp必须以较旧的Java版本启动,在我的例子中为1.7。 This worked for me: In the Java Control Panel, delete all entries for the application sesWebstart.jnlp (if exists). 这对我有用:在Java控制面板中,删除应用程序sesWebstart.jnlp的所有条目(如果存在)。 You can start the Java Cache Viewer in the command line: 您可以在命令行中启动Java Cache Viewer:

C:\Program Files (x86)\Java\jre1.7.0_55\bin> javaws -viewer

The command starts the Java Control Panel and the Java Cache Viewer. 该命令启动Java控制面板和Java Cache Viewer。 Goto the Java Cache Viewer, select the application list and delete the entry for sesWebstart.jnlp (if exists). 转到Java Cache Viewer,选择应用程序列表并删除sesWebstart.jnlp(如果存在)的条目。

Close the Java Cache Viewer an goto the Java Control Panel. 关闭Java Cache Viewer并转到Java控制面板。 Goto the Settings of the temporary internet files and delete the cache files and the application itself. 转到临时Internet文件的设置并删除缓存文件和应用程序本身。 After that, close the Java Control Panel. 之后,关闭Java控制面板。

Create a new batch file, that will start the sesWebstart.jnlp with the correct Java (the older one): 创建一个新的批处理文件,该文件将使用正确的Java(较旧的Java)启动sesWebstart.jnlp:

"C:\Program Files (x86)\Java\jre1.7.0_55\bin\javaws.exe" "D:\Users\christian\Desktop\sesWebstart.jnlp" 

Now, the sesWebstart Applet can start by executing this batch file. 现在,sesWebstart Applet可以通过执行此批处理文件来启动。

Another plausible solution that worked for me was to rename the javaws.exe(javaws2) program file of the most recent JRE/JDK since JVM always search for the newest version installed. 另一个对我有用的可行解决方案是重命名最新JRE / JDK的javaws.exe(javaws2)程序文件,因为JVM总是搜索安装的最新版本。 If you need to rollback changes, just rename again to the original value 如果需要回滚更改,只需重命名为原始值

I would advise also adding the -verbose flag. 我建议还添加-verbose标志。 eg javaws.exe -verbose http.... 例如 javaws.exe -verbose http ....

In my case, I was still invoking some java1.8 arguments (see screenshot ), so I had to also disable Java 8 in the Java control panel. 在我的例子中,我仍然在调用一些java1.8参数(参见截图 ),所以我还必须在Java控制面板中禁用Java 8。

Jnlp jre settings are under Java settings which is in Control Panel. Jnlp jre设置位于控制面板中的Java设置下。

Go to Control Panel and search "Java". 转到“控制面板”并搜索“Java”。 In my case it is Java (32-bit). 就我而言,它是Java(32位)。 Open it and select Java tab, then Java Application Runtime Settings 打开它并选择Java选项卡,然后选择Java Application Runtime Settings

you have to do in manually by doing following simple process, 你必须通过以下简单的过程手动完成,

  1. right click on jnlp file --> propeties. 右键单击jnlp文件 - > propeties。 go to attribute opens with --> click on change button. 转到属性打开 - >单击更改按钮。
  2. select browse. 选择浏览。
  3. choose path of javaws.exe of JRE version that you want whether 6 ot 7. ex. 选择你想要的JRE版本的javaws.exe的路径是否是6 ot 7. ex。 C:\\Program Files (x86)\\Java\\jre7\\bin\\javaws.exe (in my case) C:\\ Program Files(x86)\\ Java \\ jre7 \\ bin \\ javaws.exe(在我的例子中)

Just explicitly use the javaws.exe from the JRE you want, like this: 只需显式使用你想要的JRE中的javaws.exe ,如下所示:

C:\\Program Files\\Java\\jdk1.6.0_45\\jre\\bin\\javaws.exe file.jnlp C:\\ Program Files \\ Java \\ jdk1.6.0_45 \\ jre \\ bin \\ javaws.exe file.jnlp

But please have other answers in mind, like j2se version setting and jnlp spec. 但是请记住其他答案,例如j2se版本设置和jnlp规范。

I had the exact same problem. 我有同样的问题。 I created a bat file that changes the JAVA_HOME variable, then uses javaws to run the jnlp file and it worked for me. 我创建了一个更改JAVA_HOME变量的bat文件,然后使用javaws运行jnlp文件,它对我有用。

Contents of the bat file: bat文件的内容:

SET "JAVA_HOME=[path to your jre folder]"
javaws [path to your jnlp]

Hope it helps :) 希望能帮助到你 :)

只需将jnlp文件的链接拖过相应版本的javaws并将其“打开” 图片如何用javaws打开jnlp MacOS用户通常以相同的方式打开文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM