Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
If you think my answer helped you! then mark it correct! :) –  Jax-L Apr 29 at 15:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.