How to force to open JNLP File in Java 1.5.0_14 JRE instead of JRE 1.7

青春壹個敷衍的年華 提交于 2019-12-11 10:05:59

问题


I have Java 5-based Java Web Start application which I need to open on a Windows PC. PC has JRE 1.7 installed, with JRE 1.5.0_14 copied manually to the another drive (d:). The problem is that whenever I want to open the JW Start application, it opens using Java 7. Even if I use the javaws executable from JRE 1.5.0_14, somehow some properties still refer to JRE 7 files. How can I force JRE 1.5.0_14 to run just for this application?

Thanks in advance & Best Regards.

Edit 1: By the way, I forgot to mention that I need to use java 1.7 for my another app. in order to use e-sign app.

Edit 2: The JNLP file has alredy this code inside <j2se java-vm-args="-XX:MaxPermSize=128m -Xmx512m" version="1.5"/>


回答1:


Include this section in the JNLP file:

  <resources>
    <j2se version="1.5.0_14">
  </resources>



回答2:


You can do it by j2se version tag under resources

<resources>
    <j2se version="1.5" />
    <jar href="Test.jar" download="eager" />
</resources>

Following are more attributes it will help you

Tag Name:java (or j2se)

Specifies what version(s) of Java to run the application with.

version Describes an ordered list of version ranges to use.

href The URL denoting the supplier of this version of java, and where it may be downloaded from.

Stolen from here




回答3:


Here is what I do to solve my issue;

  1. Uninstall the older Java -if there is- (in my case it is 1.5.0_14 )
  2. install java equal/higher than 1.7 just to run e-sign on my web application
  3. I prepared a VBScript in order to just run the desired jre version as follows and put jre1.5.0_14, jnlp file and VBScript on the same folder and make shortcut to the VBScript to run.

    Set oShell = WScript.CreateObject("WSCript.shell") oShell.run "%comspec% /c D:\TMS\jre1.5.0_14\bin\javaws.exe D:\TMS\tt.jnlp -verbose", 1, True

Set oShell = Nothing

Thats it :)



来源:https://stackoverflow.com/questions/27382032/how-to-force-to-open-jnlp-file-in-java-1-5-0-14-jre-instead-of-jre-1-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!