Are there any problems when the project has different versions of the java compiler?

I have an eclipse workspace with several Java projects (in Maven); These are interdependent Recently, I started to change some projects to target Java 1.7. Except for solving some new warnings, compile time is no different

But when I try to run everything, I feel like something's wrong How to load class files in the following cases, and are there any problems?

>Is there a problem when a Java 1.6 project depends on a Java 1.7 project? 1.6 will VM refuse to run any bytecode generated by 1.7, or will something strange happen to make it run? > Is there a problem when the reverse occurs?

Solution

When you have a Java 1.6 project that depends on Java 1.7 project or a Java 1.7 project that depends on Java 1.6 project, you should always run your program on a higher version of JVM, in this case Java 1.7 In short, in most cases, class files built using the Java se 6 compiler will run correctly in Java se 7 But there are some exceptions For a list of incompatibilities between Java 6 and Java 7, see incompatibilities between Java se 7 and Java se 6

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>