How to Revert to Java 1.6 on Mac OS X 10.7.5

前端 未结 3 778
无人共我
无人共我 2020-12-22 21:07

I have the 1.6 installer. I\'ve used it. It does not change my Java installation, nor say there is an older version, but it does complete the installation.

I\'ve bee

3条回答
  •  北海茫月
    2020-12-22 21:59

    If you need to write code that you want to run on a previous version of Java then you can change the compile flags. This might be all you need and

    eg.

    javac -source 1.6 -target 1.6 MyClass.java
    

    The source arg states that the source is written in that version of Java, thus List strings = new ArrayList<>(); would be a compile error. Target tells the compiler to compile byte code that is aimed at the specified version of the JVM. Though I think 1.7 is fully backwards compatible with 1.5 and 1.6.

提交回复
热议问题