I’m teaching a course in which we use a DSL written in Scala.
I guided the students to www.scala-lang.org/download for the initial setup.
Some encountered problems which I think can be mitigated with a better guide and some improvements to error messages in SBT:
Downloading the “good” JDK
The download guide at scala-lang instructs the user to download the appropriate Java version.
Unfortunately, the link transfers the users to a webpage that puts Java 11 first, which may be confusing (evidently, some didn’t understand):
I propose to change the link from http://www.oracle.com/technetwork/java/javase/downloads/index.html to https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html which direct the users to the (currently) supported JDK8.
Using the “good” JDK
Lets assume the users have downloaded and installed JDK8.
Unfortunately, it does not instruct them how to handle a situation when they already have a pre-existing newer java JDK version in their system. Without a JAVA_HOME environment variable setup their system will still point to the newer (unsupported) JDK.
I propose that the initial step in downloading and installing the JDK will be split into 3 steps (better formulated than what I’ll be writing here):
- Check your java version. If it’s the good version, you’re done.
- Download and install JDK from …
- Check your java version. If it’s still not the “good” version, set the environment variable JAVA_HOME …
Better errors in SBT
Now lets assume users think that they did everything alright, but now they reach a point where they use SBT for the first time and try to build some library or application. If the wrong JDK is in use, then SBT throws some weird exception log that does not look good, and gives no clue to the actual problem.
I propose that SBT first checks the JDK version it’s using, and if it’s not among the supported versions then it will print a warning before continuing on.