Reputation: 87
I wish to try out scalafx targeting javafx 8 using scala 2.11.x on the latest version of Intellij. I have downloaded the most recent version of scalafx (scalafx_2.11-8.0.40-R8). To use JavaFx 8 I need JDK 8 however scala 2.11.x says the following:
Required Java Version The Scala 2.11.x series targets Java 6, with (evolving) experimental support for Java 8. In 2.11.x, Java 8 support is mostly limited to reading Java 8 bytecode and parsing Java 8 source. Stay tuned for more complete (experimental) Java 8 support. The next major release, 2.12, will most likely target Java 8 by default.
Question: How do I configure this? Can I just use Java 8 and scalafx in an Intellij scala project? Thanks.
Upvotes: 0
Views: 525
Reputation: 1533
Yes you can use ScalaFX 8 and Java 8 in IDEA project. In fact, ScalaFX 8 can only be used with Java 8. It supports new JavaFX 8 features, and was compiled with Java 8 as binary target. The recommended way is to use SBT. ScalaFX Hello World is an example of a simple SBT project that can be loaded into IDEA.
For a basic project it should be sufficient to add ScalaFX jar as a dependency to IDEA (as you mentioned), you will also need to add Scala binaries. ScalaFX 8 is compiled with Java 8 binary target, so you may need to set that Java level to 8.
Scala 2.11 works fine with Java 8. The "partial support" mentioned in your question is for generation of Java 8 specific byte code, and only means that Scala 2.11 compiler does not take full advantage of new Java 8 lambdas and other features when generating byte code. It does not impact Scala 2.11 and ScalaFX 8 ability to work with Java 8. For instance, you can use from Scala/ScalaFX Java libraries that use Java 8 lambdas.
Upvotes: 2