There is a duplicate issue in Mobile category Action failed: Setting Java version to Oracle 7 but this seems not to be a mobile specific problem.
The strange thing here is that I’ve been able to successfully use oraclejdk7 for some time but suddenly it stopped working. I’m not sure if this has something to do with the fact that I changed the build environment from Ubuntu 12 → 14? I also tried to change back to the previously working environment Ubuntu 12 but the problem persists and my builds keep on failing:
update-alternatives --set java /usr/lib/jvm/jdk1.7.0/bin/java
update-alternatives --set javac /usr/lib/jvm/jdk1.7.0/bin/javac
update-alternatives: error: alternative /usr/lib/jvm/jdk1.7.0/bin/java for java not registered; not setting
update-alternatives: error: alternative /usr/lib/jvm/jdk1.7.0/bin/javac for javac not registered; not setting
update-alternatives --set java /usr/lib/jvm/jdk1.7.0/bin/java
update-alternatives --set javac /usr/lib/jvm/jdk1.7.0/bin/javac
returned exit code 2
Action failed: Setting Java version to Oracle 7