1

In order to install a development environment for an older version of Android, I need to have Java 6 installed. I already, however, have Oracle Java 7 installed on my system and would like to keep it that way.

How can I install Java 6 so that the java and javac commands will refer to it in a given directory (and its sub-directories,) without messing anything up with respect to Java 7 on the rest of my system?

Charo
  • 3,631
DJG
  • 99
  • 2
  • 9

2 Answers2

1

This sounds like this similar answer by me could help:

Install both Java versions and choose the default one for the system: update-java-alternatives vs update-alternatives --config java

Not sure what the android SDK includes etc., I haven't used it. But if you work with Eclipse, you can choose a Java Version in the Settings.

The alternative, as written in the answer above, is to create a script that will edit PATH or use update-java-alternatives to change the VM and start your application.

1

No need to install older version of JDK. If you want to use older version of JDK then you can do it with latest version also.

Compile your program with these options. -source & -target.

For example,

javac -source 1.6 -target 1.6 Program.java

If you are using eclipse then it always asks you for jdk version before making classes or projects.

Deepen
  • 4,049
  • 4
  • 22
  • 32