Thursday, August 11, 2016

Play framework for Java





I'm playing around with the Java framework Play ideally for hosting a MySQL database for a personal data project I'm working on. I could do this in Python with the Django or Flask frameworks, but Play seems like a good way to learn some more Java. So here I go.

I came across an error which thought would be worth sharing the solution to.

Play uses Lightbend Activator to install the required run times. After I set the system path as it requires you to, I tried to run activator new, from the command line. It threw the following hissy fit: 



Unable to access jarfile C:Program Files\activator-dist-1.3.10\bin\test\play-java\libexec\activator-launch-1.3.9.jar 

Turns out the problem is spaces in the path names. The whole directory at line 42 the activator.bat needs to be declared as a string to run properly. 

Simply add quotes as follows: 

before: 
for %%d in (%BIN_DIRECTORY%) do set ACTIVATOR_HOME=%%~dpd 

after: 
for %%d in ("%BIN_DIRECTORY%") do set ACTIVATOR_HOME=%%~dpd