0

My application will support only java 1.6 version and I need to execute all test cases using java 1.7 compiled class files code.

My question how to reach above requirement...

  1. Is it possible to install both java 1.6 and java 1.7 versions in my machine?
  2. If possible how can i set java 1.6 path for my application and how i can set path for java 1.7 version to execute test cases using java 1.7 compile files.

Application will not open with Java 1.7, but I need to use java 1.7 compiled files only.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user3016945
  • 265
  • 1
  • 6
  • 10
  • *"Please anyone give solutions Thanks in advance"* AKA '4 lines of noise'. Please leave it out in future. – Andrew Thompson Dec 26 '13 at 10:17
  • You certainly *can* install multiple versions of Java, but your statement that "My application will support only java 1.6 version" already means your application has a bug. Oracle has already end-of-lifed Java 6, and even essential security fixes require support fees. – ruakh Dec 26 '13 at 10:17
  • Yes, it is possible. It would be helpful to know what platform you are talking about but generally it boils down to installing to separate directories and making sure you use the executable of the right java version e.g. by setting your PATH or by using an absolute to it. – Jilles van Gurp Dec 26 '13 at 10:26
  • my application is admin tool its supports java 6 platform is windows.Gurp can you any links which helps me to set multiple versions paths in same machine – user3016945 Dec 30 '13 at 04:54

3 Answers3

2

Yes , it is possible. You need to change JAVA_HOME environmental variable. You can set it in the script that is used to start the application.

This article might help you

pratim_b
  • 1,160
  • 10
  • 29
0

Yes it is possible.

You can install multiple java versions in single system.

To make it simple. You can use eclipse , or Netbeans IDE. In that you can use different java versions to compile.

Sujith PS
  • 4,776
  • 3
  • 34
  • 61
0

Like any program, you need to specify the directory of the program you want to run, either directly by giving the full path name, or indirectly by setting an environment variable like PATH or JAVA_HOME OR JDK_HOME

You can install any number of updates/versions of Java until you run out of disk space. To configure each program to use a specific version you need to look at how they are started and set appropriate directory to use Java from for that program.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • Thanksfor your reply.can you give any idea how set path for two java versions in java code – user3016945 Dec 27 '13 at 08:02
  • @user3016945 You cannot gloabally set two paths, what you need to do and when you start one program or the other set the PATH first. Is there a script which start one of the these programs? If so modify that script. If not add a script to modify the PATH before starting it. – Peter Lawrey Dec 27 '13 at 09:50