Java version collision for beginners (weird SBT errors)


#1

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.
image
Unfortunately, the link transfers the users to a webpage that puts Java 11 first, which may be confusing (evidently, some didn’t understand):

:point_right: 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.

:point_right: 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):

  1. Check your java version. If it’s the good version, you’re done.
  2. Download and install JDK from …
  3. 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.

:point_right: 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.


#2

I created a PR for the first issue here:


#3

Is something known to break on OpenJDK 11?


#4

Apparently, a branch I made of the singleton-ops library failed to build. I have not investigated further. I just helped the student to get his project going.


#5

Can you share the build output?


#6

It was on my student’s computer, and I’ve already resolved the issue there.
FWIW, It was a windows 10 setup.