问题
The Scala compiler generates byte code like Java compiler which could be run on a platform dependent JVM right?Then why do we need complete JDK as a pre-requisite?Is it for including few Java items within scala and debugging it?Please provide some insights.
回答1:
I've just tested this claim on a system with sbt and a JRE but no JDK. Compiling works fine: the JDK is not required. You'll need it for jarsigner if you are going to sign your .jar files or do other obscure things.
回答2:
From the official source: https://wiki.scala-lang.org/display/SYGN/General+FAQs
What JRE should I use to run Scala?
Any JRE supporting Java 1.4 or 5.0 or 6.0 byte-code should work. We regularly test Scala on:
- Sun HotSpot JRE for Java 1.4.2, on Linux/x86 and Windows
- Sun HotSpot JRE for Java 5.0, on Linux/x86, Windows, Mac OS X/x86 and Mac OS X/PPC (Whilst running fine on Apple's Mac OS X for Intel, the Mac OS X PowerPC JVM supports Scala only in interpreted mode. JIT (mixed) mode is not supported. Run java -Xint to deactivate JIT. Interpreted execution is up to 10x slower than JIT execution.)
- Sun HotSpot JRE for Java 6.0, on Linux/x86, Windows and Mac OS X/x86
- IBM J9 JRE 2.3 for Java 5.0 on Linux/x86
- IBM J9 JRE 2.4 for Java 6.0 on Linux/x86. HotSpot 1.6 is the standard JRE we use for Scala, and should be the most stable. We have however observed significant speed improvements on Linux when using J9.
So the short answer, JRE is enough - no need for a full JDK.
Note that you do need a JDK for development (that is, to compile you Scala code into Java bytecode).
来源:https://stackoverflow.com/questions/27854815/scala-programs-need-jdk-open-jdk-as-a-pre-requisite-or-jre-would-be-enough