Migrating from java version 8 to 7

I installed Java 1.8 from Oracle on Ubuntu, because although it would be better, the new version is compatible with the previous ones. But this is not so. javac1.8 displays bytecode that runs only on java-8 oracle, scala does not run.

Before the upgrade, I used java-7-openjdk, everything was in order. While I can select my old virtual machine with sudo update-alternatives --config java, but I also need to be able to choose an older compiler. How can i do this?

+4
source share
3 answers

Use the flag -targetto generate bytecode for an earlier version. For instance. javac -target 1.5 FooBar.java.

No need to lower.

+4

, Oracle JDK ( OpenJDK): oracle-java7-set-default, oracle-java8-set-default, , Java .

: http://ppa.launchpad.net/webupd8team/java/ubuntu ( Oracle JDK). : https://launchpad.net/~webupd8team/+archive/java

PATH JAVA_HOME, . /etc/environment

, , 1.7, Java-SE 7- - JDK 8. , , - API- Java SE 7.

JDK, , - ( ).

, , JDK . IDE , .

+1
  • java_home Java, . , java.exe .

  • -target.

+1
source

Source: https://habr.com/ru/post/1538257/


All Articles