I have installed Java 1.8 from Oracle on Ubuntu because I though it would be best, newest version compatible with previous ones. But it is not.
javac
1.8 produces bytecode runnable only on the java-8-oracle, scala does not run.
Before upgrade I was using java-7-openjdk, everything was fine. While
I can choose my older virtual machine using sudo update-alternatives --config java
, but I also need to be able to choose older compiler.
How can I do this?
Use the -target
flag to generate bytecode for earlier version. E.g. javac -target 1.5 FooBar.java
.
There's no need to downgrade.