LabelServer4j Example User Interface
LabelServer4j is a headless background service — it has no graphical user interface. All interaction with the service is through configuration files, log files, and (on Windows) the Windows Services control panel.
Starting LabelServer4j
Windows
LabelServer4j can be installed as a Windows service so that it starts automatically when the server boots and restarts automatically if it crashes. Once installed as a service it is managed through the standard Windows Services management console (services.msc) or the command line:
net start LabelServer4j net stop LabelServer4j
It can also be started directly from a command prompt for testing:
start_labeller.cmd
Linux / macOS
Start from the terminal using the provided shell script:
./start_labeller.sh
Or directly:
java -cp ./LabelServer.jar:./lib/devonly/i4jruntime.jar com.commander4j.labeller.Service
The process runs in the foreground. Use a process manager (systemd, launchd, or nohup) for production deployment.
Monitoring
Since there is no GUI, the primary monitoring tool is the log file:
logs/c4jLabelServer.log
The log records every event in detail:
- Service startup and configuration loading
- Each labeller thread starting
- Every CSV file detected and processed
- Every command sent to a printer and every response received
- File operations (upload, download, backup, delete)
- Errors and exceptions with full context
Log files rotate at 10 MB and are retained for 14 days.
What to Look For
| Situation | What to check in the log |
|---|---|
| Label not printing | Look for the CSV filename being detected; if absent, check the input path in labellers.xml |
| Printer not responding | Look for TCP connection errors or timeout messages for that labeller's IP and port |
| Wrong data on label | Check the variable substitution log lines to see what values were sent |
| Script error | Look for the script line number and command that caused the failure |
| File stuck in input directory | File renamed to .in means the script is running or failed — check for a .error file
|
Configuration Changes
To change a labeller's IP address, port, command script, or input path, edit the relevant labellers.xml file and restart the service. Changes to configuration files are not picked up at runtime.
To switch site, edit xml/config/config.xml and change the site id attribute, then restart.
Thread Architecture
When running, LabelServer4j maintains the following threads:
- One main service thread (lifecycle management)
- One server thread (configuration and orchestration)
- Per enabled labeller: one labeller thread, one TCP receive thread, one TCP transmit thread
The thread count grows with the number of configured printers. A site with six printers typically runs around 20 threads in total.
Graceful Shutdown
Sending a termination signal (Ctrl+C on Linux/macOS, or stopping the Windows service) triggers the shutdown hook. LabelServer4j signals all labeller threads to stop, waits for any in-progress print jobs to complete, then exits cleanly.
See also: Overview LabelServer4j, LabelServer4j Configuration, LabelServer4j Operation, Install Interface Services