2

we have one java application which can work only on 1.6 and a website which works only on the latest java 1.7.

We have both java installed on our computer. But unfortunately, it cannot detect automatically which java to use while running applications.

It seems by default computer use 1.7 so when I use the application, I have to go to control panel and disable 1.7 so that computer can use 1.6.

Is there any solution to it? Like computer understands automatically 1.6 for the application and 1.7 for loading on browser.

8
  • I was able to find this question over at Stackoverflow. Looks like you will have to configure the path variables and likely require the source to both the application and the website. stackoverflow.com/questions/271609/…
    – Ramhound
    Commented Jan 3, 2014 at 13:38
  • blogs.oracle.com/stevenChan/entry/running_multiple_java_plugins that is good way I think.
    – avirk
    Commented Jan 3, 2014 at 13:40
  • @avirk - The program in article in question is from 2007 I guarantee you that JInitiator is not supported by Java 1.6 or 1.7
    – Ramhound
    Commented Jan 3, 2014 at 13:50
  • 2
    @avirk - If you have not even confirmed it still works with the current version of Java how can you suggest it?
    – Ramhound
    Commented Jan 3, 2014 at 13:57
  • 1
    @avirk - I suppose thats what comments are for, I just don't think its all that responsible, to suggest a solution that you have not personally tried.
    – Ramhound
    Commented Jan 3, 2014 at 14:01

2 Answers 2

4

The problem is that the Java version to use is configured up in a system variable JAVA_HOME and/or by adding the relevant java.exe to the bin path and the whole system looks at those two locations.

To run using a different java version you just have to run that version.

So configure whichever version you want in your web browser as your main one.

Then create a link/batch/whatever to run the program and directly select the java you want to run. i.e.:

/java6/bin/java.exe MyApp.jar
2
  • the application is just a client running through java webstart so there is no environmental variable called java_home ..I'm not sure how to create a batch file Commented Jan 24, 2014 at 8:44
  • Running through web start I don't think you can, you have to run in whatever version of Java they have installed.
    – Tim B
    Commented Jan 24, 2014 at 9:09
0

If you are using Java 1.7.0_40+, you would probably be able to solve your problem by using deployment rule sets:

A new feature is being introduced in Java 7 update 40 called “Deployment Rule Set,” designed to address the issue of security and compatibility in browser applets without affecting normal back-end Java programs like Eclipse, Freemind, or Tomcat. Specifically this deployment rule set addresses two major points:

The desktop administrator’s ability to control Java version compatibility, and default choices on the end-user’s desktop. For example your users may use most recent security updates for most browser applets but still use an old Java 1.6 for that one legacy application that is no longer maintained. The end-user’s awareness of who created the application and their default interaction (ask, run, or block). By seeing the actual company or signer, the user is protected from running code by someone that they do not know. For example, I would trust “My University” or “Erik Costlow” but not “Unknown publisher” or someone else claiming to be me. For more information please review Oracle's Article on Deployment Rule Sets

https://blogs.oracle.com/java-platform-group/entry/introducing_deployment_rule_sets

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .