Fixing Lightbend Activator on Windows

Since (everything related to) Scala has locked my attention for some time now I decided to take a more scrutinizing look at and play around with Play Framework (excuse my tautology). As you may already know, the easiest way to get started with creating your web application in Play! is using Lightbend Activator, which automagically creates a skeleton based on a template of your choosing.
You already have Activator and SBT installed on your computer, I presume. You also tried running it and probably noticed that it spits "system cannot find" error (or a warning) in the second line of it's output:

C:\Users\dev\projects>activator new
The system cannot find the file BIN_DIRECTORY\..\conf\sbtconfig.txt.

Mind you that Activator and anything you create when running it will still work since it will switch to using default SBT configuration settings, but it is still not an option in some cases.
Activator is launched using activator.bat script located in setup directory:


First thing you need to do to fix it is edit this file. Fire up your favorite text editor and open above file, e.g.

notepad C:\activator-dist-1.3.10\bin\activator.bat

Scroll down to or search for line containing set SBT_HOME=%BIN_DIRECTORY As you might already notice, this line is missing closing % sign for %BIN_DIRECTORY% variable. Enter it, set SBT_HOME=%BIN_DIRECTORY% save and close the file. Try running activator new command in the CLI now:

C:\Users\dev\projects>activator new
The system cannot find the file C:\activator-dist-1.3.10\bin\..\conf\sbtconfig.txt.

Error message changed slightly, but it is still an error message. There is no conf directory containing sbtconfig.txt file. Exit Activator with Ctrl+D. Change directory to where you have installed Activator:

C:\Users\dev>cd c:\activator-dist-1.3.10

Instead of creating new config/sbtconfig.txt file in this directory just link folder conf to point to where original SBT configuration file is stored:

c:\activator-dist-1.3.10>mklink /j conf "c:\Program Files (x86)\sbt\conf"
Junction created for conf <<===>> c:\Program Files (x86)\sbt\conf

Try running activator new again:

C:\Users\dev\projects>activator new
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

That's that. Error is gone and Activator will use same sbtconfig.txt file as your SBT installation. Enjoy.