Command Box Slow in Loading

When I open my command prompt to the directory where my box.exe file is located and type “Box”, CommandBox takes forever to load. I’m talking up to 5 minutes sometimes.

Any idea how to speed things up?

Every single time I’ve seen this, it’s antivirus. Usually, it’s an easy premise to bear out, just look at the processes, sorted by CPU in your task manager and you’ll likely see your antivirus or Windows defender, or Anti malware service executable going to town. There are a lot of jars in CommandBox and antivirus that scans every archive means they have to unzip every war, and jar. And the Lucee jar has up to three levels deep of nested jars inside of it.

Putting an exclusion on normal antivirus to ignore both box.exe as well as your .CommandBox folder is often fairly easy so long as your network admins allow you. Turning off Windows defender gets harder in every version and requires a registry hack in Windows 10, but once you do (I personally abjor antivirus) it makes everything fly.

Thanks for the intel. I turned Windows Defender off and box loaded in about 30 seconds.

Mike Letson

Senior Developer

CF Webtools

You Dream It…. We Build It

11204 Davenport St Ste 100

Omaha, NE 68154

O: 402.408.3733 x142


S: mike.cfwebtools

Glad to hear it improved, but 30 seconds still sounds slow! Was that for a first-run or just a normal start of box after it’s already extracted itself before? Just double clicking box.exe should get you a terminal window prompt in under 10 seconds, and depending on your CPU speed, usually just 3-4 seconds. If there are no other processes in Windows task manager eating any CPU during that 30 seconds other than box and java, then you can see if you have anything funky going on like hanging networking calls (There used to be issues related to this since Java likes to get the mac address from your network adapter for part of Java’s random libs) If you’ve a mind to, here’s how you can dig even more:

  • Install a JDK if you don’t already have one and open a cmd window in the bin folder of that JDK (where jstack lives)

  • Open Window task manager and sort by process name

  • Start CommandBox in a new window

  • Quickly sort for “java.exe” and get the PID of your CLI process that’s starting

  • Flip over to the cmd window and run
    jstack -l

  • This will give you a thread dump of the entire JVM as it’s starting. Find the “main” thread and see what it’s doing.

  • If antivirus is still slowing you down, the Java thread will usually show that it’s unzipping jars or something file system related to jars (antivirus has hooks in the underlying file system to prevent those operations to complete until the scan is done)

I have the same problem of 30 sec start up times. I’m using Raspi 4 4GB Buster/headless. Tried using several jdks 11 to 8. Jdk 8 loads in about 13 sec, where all others load box in about 30 sec. Below is the jstack -l for openjdk version “1.8.0_212”.

Curious if you see anything that could be improved?

thanks in advance for your help

openjdk version “1.8.0_212”

OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1+rpi1-b01)

OpenJDK Client VM (build 25.212-b01, mixed mode)

That stack trace isn’t doing anything. It’s just sitting at the terminal prompt waiting for input from the user. That’s what the readLine() does. It blocks until the keyboard enters a line. Does it show that exact stack trace the entire time it’s loading?

Yes. soon as I type in box and hit enter. Then pull the stack trace until it loads up. Thats the exact output.

Then it may just be a problem with the terminal not drawing the screen. Have you tried a different terminal app?

What if you try and interact with the shell even though it hasn’t loaded. Like try typing “version” and hit enter even if the prompt doesn’t appear yet.

I typically connect via osx terminal via ssh. But I get the same delay with logging on directly with keyboard attached. If I type “version" it doesn’t load any faster and runs the command it loads. returns 4.8.00059.

Just to give some background. As this is not the typical use case for lucee/commandbox. This is on a Pi 4 4Gb running buster. I use the PI for reading sensors. Boot time is my primary concern as not much happens on the device except polling sensors. But fast start up time is important.

I ran some some tests with a stop watch to give some feedback to you using different jre’s .

Each time I removed and purged the packages for java and commandbox (apt) ,rebooted. then re-installed, rebooted and tested.

This test was simply load “box” after the installation was complete. Timing it with a stopwatch on my phone.

openjdk-8-jre-headless , box 10 Second load.
openjdk-9-jre-headless , box 24 Second load.
openjdk-10-jre-headless , box 24 Second load.
openjdk-11-jre-headless , box 24 Second load.

So not sure why such a difference on 8 than 9-11 jres but its a big one, but consistent after v8. If you want me to run any tests just let me know.

Thanks for the help as always.


Interesting differences. For what it’s worth, I still recommend Java 8 because the version of Lucee that CommandBox is on does not have full Java 9+ support.

Thanks for that. Java 8 it is then.