Frequently Asked Questions
How is diet4j different from exec:java
or tomcat:run
?
diet4j is for production servers. It has no maven dependencies itself. It can run command-line applications as well. It could be fairly easily extended to cover other kinds of module systems as well — including simultaneously.
The goal is really to provide a few foundational building blocks so that Java modules aren’t forever 2nd (third, fourth?) class citizens on Linux distros. Few distros ship any Java modules, but lots of them ship perl modules and python and node and what have you. We hope that diet4j could change that.
Does diet4j download code at run-time?
Currently, no. diet4j right now is the equivalent of
a Perl @INC or C shared library path, but for Java. It's not a package manager, but
should nicely interact with one: a package manager could put various modules into
/var/lib/java
, and all apps using diet4j will pick up the modules they
need from there without having to do any additional work.
However, dynamic code download could be easily added if people thought diet4j should do that.
Just how exactly do I run diet4j-based server apps using jsvc?
There's a systemd.service
file
in Github,
which shows you both how to start and stop the jsvc-based diet4j daemon. To use it
with systemd, replace the various FIXME
tags with the name of the
diet4j root module, the location of the PID file and so forth. To try it out,
use diet4j-examples-activate
as the root module. Save this file into
one of the recognized systemd service file locations on Linux (such as
/etc/systemd/system/mytest.service
),
invoke systemctl daemon-reload
to have systemd pick it up, and
start your daemon with systemctl start mytest.service
. If everything
works as it is supposed to, this will log the activation and deactivation in the
system log (see journalctl
) because that's all that the example
module diet4j-example-activate
does.
If you do not use systemd, use the equivalent of the start and stop commands in your environment.