Setting up your first BoxLang Server
Robert explains quickly spinning up a BoxLang server commandbox cfmlMay 17, 2024 / Robert Zehnder
This post has been updated to specify the --save flag with the bx-compat module and the boxlang.json settings documentation. Updating default engine to JDK21
It is easy to get started working with BoxLang, but I thought I would put together a quick post on how to get started with a development server. The first step is to setup your webroot.
mkdir Development/boxlang
cd Development/boxlang
Since I will be developing locally with CommandBox, lets install the BoxLang CommandBox CLI tools.
box install commandbox-boxlang
The next step will be to install the BoxLang compatability module. This will populate the server
scope with the appropriate engine details. The easiest way to ensure this module is installed is to add it to onServerInitialInstall
in the scripts
section of your box.json
. If you forget
the server, it will reinstall the module the next time it is started.
...
"scripts":{
"onServerInitialInstall":"install bx-compat"
},
...
Once the bx-compat
module has been installed, set the appropriate engine for the application. This is accomplished by creating boxlang.json
inside your webroot.
{
"modules" : {
"compat" : {
"disabled" : false,
"settings" : {
"isAdobe" : false,
"isLucee" : true
}
}
}
}
You can find a reference to all boxlang.json
settings here.
Once all of that is done, we can go ahead and scaffold our new application using the ColdBox advanced script template (or you can just start coding).
box coldbox create app
Now the groundwork is done, it is time to spin up the server.
box server start cfengine=boxlang javaVersion=openJDK21_jdk
If you do not have the Java 21 JDK installed you will need to specify the Java version to use. Currently BoxLang requires the use of the JDK and not just the JRE.
You should now have a BoxLang server up and running.
Enjoy!