Old projects compatible with Java 7

后端 未结 5 1285
迷失自我
迷失自我 2021-02-14 01:38

My old projects use Java 6 (1.6), and I don\'t know when I update (Java 7), they can run fine ?

相关标签:
5条回答
  • 2021-02-14 02:11

    AFAIS here, there's no Java 6 features which get deprecated in Java 7 so yes, your project should run fine.

    0 讨论(0)
  • 2021-02-14 02:11

    There shouldn't be any compatibility differences as the JVM is basically the same. However it is early days so there may be subtle differences which cause a problem which people are not yet aware of.

    e.g. Eclipse looks at the Supplier in the java.exe on Windows and sets the command line arguments differently for different suppliers. It has a problem with Java 6 update 22 because Oracle wanted to change it from "Sun" to "Oracle". I believe this has been changed so it is "Oracle" in Java 7 (but still "Sun" for Java 6)

    My point being, that if you write generic Java code, you shouldn't have a problem. However, if you are doing something a bit unusual, you are likely to need to re-test your application.

    0 讨论(0)
  • 2021-02-14 02:14

    They should do, yes. Java has a reasonably strong history of backward compatibility. However, if these are in any way important projects you should still perform a thorough test pass before deploying anywhere production-like.

    0 讨论(0)
  • 2021-02-14 02:18

    As was already stated backward compatibility is a very important aspect in new Java releases, so in general there should be no problems in switching to a newer Java version. In this case, however, Java 7 seems to have a few bugs in the new hotspot compiler optimizations. The Apache Software Foundation has issued a warning that their products Lucene and Solr are affected by these bugs.

    http://lucene.apache.org/#28+July+2011+-+WARNING%3A+Index+corruption+and+crashes+in+Apache+Lucene+Core+%2F+Apache+Solr+with+Java+7

    The affected loop optimizations can be switched off by starting java with -XX:-UseLoopPredicate.

    0 讨论(0)
  • 2021-02-14 02:19

    There is an official list of known incompatibilities between java 6 and java 7 from Oracle (including descriptions of both binary and source-level incompatibilities in public APIs).

    Also you can look at the independent analysis of API changes in the Java API Tracker project: http://abi-laboratory.pro/java/tracker/timeline/jre/

    The report is generated by the japi-compliance-checker tool.

    0 讨论(0)
提交回复
热议问题