简体   繁体   中英

Creating a new project for Maven Central - What JDK version to use?

Since JDK versions are not backward compatible , ie bytecode (*.class) files created with JDK X might not run under JVM X-1 or older (JDK 1.8 bytecode might not run on a JVM 1.5), how can I determine what version of Java should my project be built with if I want to submit it to Maven Central?

If I use the most recent Java and use its latest language feature, my project would not reach most users as the could not run my project with their JVM. However, I do not want to write my software with Java 1 neither. So, how does one determine the JDK version to use? What is the "standard", if there is any?

最好在Java 7中提供它,以便可以在6到8版本中使用它,但是您将失去一些函数式编程方法

Java 7 is the answer, as of beginning of 2017.

Nothing better than a survey to find out what version of Java is mainly used out there. The following Java Tools and Technologies Landscape Report 2016 article gives some really interesting insights. Apparently, 90% of projects in production use the last two versions of Java (as of this writing, Java 8 at 62% and Java 7 at 28%).

Thus, for Maven Central, it is pretty safe to use the version just below the current one to reach most projects. Ashok Kumar N suggestion to use Java 7 makes perfect sense since it is strongly compatible with Java 6 . Thus with Java 7, one can catch 99% of the market.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM