Need help running Lucee on Amazon Linux 2

I successfully ran the installer for Lucee v, and everything seems to have gone where it was meant to go. OpenJDK 11.0.18 is located at /opt/lucee/jre

When I go to /opt/lucee/tomcat/bin and try to execute or, I get an error about missing environment variables for JAVA_HOME or JRE_HOME. I still get this error if I first export JAVA_HOME=/opt/lucee/jre/
I tried creating a shell script to set that environment variable at /etc/profile.d/ and logged out of the shell and back in, but I still get the error about the environment variables missing. Now I’m out of ideas. Thoughts? TIA

In *nix those variables for Tomcat are usually set in path-to-lucee/tomcat/bin/ as specified in Tomcat docs (search for

Just to add to how *NIX works, binaries run as users, be it real or service level accounts. Often times they are service accounts that do not know anything unless explicitly added.

.ENV in your profile usually holds the enviromental vars.
you can run in bash PRINT ENV
This will show your environment.
As Andreas explained, you need JRE_HOME or JAVA_HOME defined in your ENV

1 Like

I don’t see a file anywhere. The installer put tomcat at /opt/lucee/tomcat/. Do I need to create in the tomcat/bin directory and add my env variable there?

thanks for that. the printenv command shows JAVA_HOME=/opt/lucee/jre/, which is the correct path. How does the Lucee start script not find it?

You need to check the binary user “service user” that is running the program, that is the user and or group that needs to understand where lucee is, where java is and how to start it correctly.

what does systemctl list-units --type=service show
What user is lucee running as?
Did you su to that user and try starting ?

Generally as I am not sure if you did this, this is how I would setup lucee
install java (I will assume you did this)
add lucee user and group ( I will assume you did this)
run vi /etc/systemd/system/lucee.service

Description=Apache Lucee


Environment="JAVA_OPTS=-Dfile.encoding=UTF-8 -Djava.awt.headless=true"




Test your configuration

systemctl daemon-reload
systemctl start lucee
systemctl enable lucee

If that fails you did something wrong, try again. Check your logs and how you set up java and lucee service permissions.

As I wanted to note, you will need to modify the above slightly for your use
generally, /home/ec2-user/“AppName” is where I place system account users and their binaries they run. So if its completely vanilla you would place catalina.home in /opt/lucee/. I have to run or I would edit this to help you a bit more.

Yes. Please see the tomcat docs that I Iinked in my previous post (and search for it’s all written in there.