简体   繁体   English

用JDK 7编译的Scala代码可以在JVM 8上运行吗?

[英]Can scala code compiled with JDK 7 run on JVM 8?

I have a project using scala for several microservices. 我有一个使用scala的几个微服务项目。 We are planning to move to Java 8, but due to the limitation of gradle's Scala plugin and the compatibility between scala and Java 8, those micro services will still be compiled on JDK 7. My question is will they run on JVM 8 without any modification or specific configurtion? 我们计划迁移到Java 8,但是由于gradle的Scala插件的局限性以及scala和Java 8之间的兼容性,这些微服务仍将在JDK 7上编译。我的问题是,它们将在不做任何修改的情况下在JVM 8上运行或特定配置?

Scala 2.11 which is just released is not yet compatible with Java 8 bytecode. 刚刚发布的Scala 2.11尚不兼容Java 8字节码。 However JVM 8 is backward compatible, so as long as you are still compiling your Scala code on JDK 7 and you just drop it in JVM 8, everything will be working fine. 但是JVM 8是向后兼容的,因此,只要您仍在JDK 7上编译Scala代码,并将其放在JVM 8中,一切都将正常工作。

Might not be applicable to you, but latest Scala only works with JDK 6+, so nothing lower than JDK 6. 可能不适用于您,但是最新的Scala仅适用于JDK 6+,因此没有低于JDK 6的版本。

Yes, they will. 是他们会。 So will those compiled on Java 6 or 5. I am not sure about earlier versions, but would still expect them to work. 用Java 6或5编译的代码也一样。我不确定较早的版本,但仍希望它们能工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 可以编译 Java 8 代码以在 Java 7 JVM 上运行吗? - Can Java 8 code be compiled to run on Java 7 JVM? java可以运行编译好的scala代码吗? - Can java run a compiled scala code? 如果我用最新的 JDK 编译了一个 Java 文件,那么旧的 JVM 是否能够运行 .class 文件? - If I compiled a Java file with the newest JDK, would an older JVM be able to run the .class files? JVM-非jit编译的代码如何运行 - JVM - How is non jit-compiled code run 为什么我需要 JVM 来运行 AOT 编译代码? - Why do I need JVM to run an AOT compiled code? 使用较旧的JDK编译的Java代码无法与较新的JRE / JVM一起正常工作 - Java code compiled using an older JDK will not work properly with a newer JRE/JVM JVM如何理解由JDK和Eclipse两者编译而成的字节码,两者都不相同? - How does JVM understand the byte code compiled by both the JDK and Eclipse while both are different? 无法扩展由早期版本的Scala(scala 2.11.4,sbt 0.13.7,JDK 8)编译的宏 - Can't expand macros compiled by previous versions of Scala (scala 2.11.4, sbt 0.13.7, JDK 8) 在JVM 5或更低版本上运行JVM 6编译代码 - Running JVM 6 compiled code on JVM 5 or lower 当 Scala 都被编译成仅由 JVM 运行的 .class 文件时,Scala 比 Java 快吗? - How is Scala faster than Java when both are compiled into `.class` file which is run by JVM only?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM