Jump to content

Installation: Difference between revisions

From Commander4j
Created page with "== Install Database == Commander can work with mySQL, MSSQL or Oracle databases. Without going into the specifics of how each database product works the following is a checklist of what needs to be done in order to prepare the database for use with Commander4j. General recommendations. If we assume that your just wanting to get the application working with the least amount of work then I would recommend installing SQL Server Express for Windows based comput..."
 
Updated by push_wiki.py
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Install Database ==
'''Installation''' covers the server-side components that an IT person sets up once the basics are working. For installing the database, the application and the database connection, follow the step-by-step [[Install Guide]] instead.


Commander can work with [[mySQL]], [[MSSQL]] or [[Oracle]] databases. Without going into the specifics of how each database product works the following is a checklist of what needs to be done in order to prepare the database for use with Commander4j.
{| class="wikitable"
! Task !! Page
|-
| Which file to download || [[Downloads]]
|-
| Install SQL Server Express, MySQL, MariaDB or Oracle || [[Install Database]]
|-
| Run the Commander4j installer (Full or Workstation) || [[Install Commander4j]]
|-
| Connect Commander4j to the database and create the tables || [[Setup4j]]
|-
| Log in for the first time || [[First Login]]
|-
| Move to a newer version || [[Upgrading]]
|}


General recommendations. If we assume that your just wanting to get the application working with the least amount of work then I would recommend installing SQL Server Express for Windows based computers. For MacOS I would recommend mySQL and for Linux you have the choice of mySQL or Oracle. To be accurate most databases will work with most operating systems using Docker these days - but in the interest of simplicity I would use the previous recommendations. Apologies to any Oracle DBA's out there but I would not recommend it unless you have a lot of previous experience.
The sections below are only needed for hand-held scanners, ERP interfaces and barcode printers.


== [[mySQL]]==
== Install Java ==
A detailed guide showing how to install mySQL under windows can be found [here](https://dev.mysql.com/doc/mysql-installation-excerpt/8.2/en/).
 
* Create a database/schema user account for Commander4j to use.
The Windows and macOS installers include their own copy of Java, so a normal desktop installation needs nothing extra. You only need to install Java 25 yourself in two cases:
* Create a user which has the newly created database as it's default schema.
 
* Ensure that the new user has sufficient permissions to create tables/indexes/views etc.
* '''The web component''' (the scanner web application) on the server that runs Apache Tomcat. Tomcat itself needs Java to run.
* Better to grant too much rather than too little initially.
* '''The desktop application on Linux''', because the Linux installer does not bundle Java.
* Ensure that the database is using TCP/IP (SQL Server).
* Ensure that the database is accepting remote connections (All)
* Ensure that the user is allowed to connect remotely (mySQL)


In both cases install the '''JDK''' (not the smaller JRE). The Azul Zulu JDK 25 from [https://www.azul.com/downloads/?package=jdk#zulu https://www.azul.com/downloads/?package=jdk#zulu] is recommended; on Windows choose the <code>.msi</code> installer and tick the option to set <code>JAVA_HOME</code>, which the Tomcat installer looks for.


== [[MS SQL|Microsoft SQL Server]] ==
'''Note that the web application should be installed on a nominated server machine and not on workstations.'''


A detailed guide showing how to install MS SQL Server under windows can be found [here](https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server?view=sql-server-ver16).
== Install Tomcat 11.x ==
* Enable the TCP/IP communication protocol as it maybe disabled by default.
* Create a database/schema user account for Commander4j to use.
* Create a user which has the newly created database as it's default schema.
* Ensure that the new user has sufficient permissions to create tables/indexes/views etc.
* Better to grant too much rather than too little initially.
* Ensure that the database is accepting remote connections (All)
* Check firewall rules allow for connections
* Ensure that the user is allowed to connect remotely (mySQL)


== [[Oracle]] ==
Apache Tomcat 11 is required for the web component. Download it from the [https://tomcat.apache.org/download-11.cgi Apache Tomcat site]. On Windows choose the '''32-bit/64-bit Windows Service Installer''' so that Tomcat runs as a service and starts with the machine. The installer asks for the Java location: point it at the JDK you installed above.
A detailed guide showing how to install Oracle under windows can be found [here](https://docs.oracle.com/en/database/oracle/oracle-database/23/install.html).
* Create a database/schema user account for Commander4j to use.
* Create a user which has the newly created database as it's default schema.  
* Ensure that the new user has sufficient permissions to create tables/indexes/views etc.
* Better to grant too much rather than too little initially.
* Ensure that the database is using TCP/IP (SQL Server).
* Ensure that the database is accepting remote connections (All)
* Check firewall rules allow for connections


== Install Java ==
== Configure Tomcat / Web Application ==
* Install Java 17
 
  Recommend installing the JDK.  
The web component of Commander4j is a single file, '''c4j_commander4j_web.war''', included with every release from version 12.75 onwards (it replaced the three separate web applications of earlier releases, which are listed below for sites that still run them). It contains the scanner pages and the REST API they use.


== Install Tomcat 10.x ==
The servlet (.war) files shown below are intended to work on Zebra Mobile Computers which have the Zebra Enterprise Browser installed.
* Download from [http://tomcat.apache.org/ Apache Tomcat Site]
  Ensure you download the 32/64Bit Windows Service Installer package.


== Install Commander4j ==
{| class="wikitable"
* Obtain the required installation package.  
! Servlet !! Purpose !! Environment !! Notes
  This can be downloaded from [http://www.commander4j.com Commander4j Website]
|-
  On a server select the "Full" install option from the setup screen - normally a users PC will require the "Workstation" install.
| '''c4j_commander4j_web.war''' || Pallet Transactions, Quality Grading, Issue / Return || Any Mobile Browser || * Recommended from 12.75
|-
| '''c4j_web_react.war''' || Pallet Transactions || Any Mobile Browser || Earlier releases
|-
| '''c4j_web_WS.war''' || Quality — Product Grading || Any Mobile Browser || Earlier releases; only needed for Quality Control
|-
| '''c4j_web_Issue.war''' || Issue Pallets to Order & Location || Tablet Mobile Browser || Earlier releases; Issue/Return of Stock
|}


[[File:Install1.png]]
Installing the web element of Commander4j is straightforward and requires copying files from the Commander4j install directory into the Tomcat directory:


<br>
* Stop the Apache Tomcat service if it is running.
Run the appropriate installer for your operating system.
* Copy the file '''chosen_servlet.war''' from the Commander4j directory into the WebApps subdirectory of the Tomcat installation directory.
<br><br>
* Start the Apache Tomcat service.
[[File:Install2.png]]
* You should then notice that the '''chosen_servlet''' directory has been created under WebApps.
<br>
* Update the list of hosts the web application can connect to by copying "Commander4j/xml/hosts/hosts.xml" into "Tomcat/WebApps/'''chosen_servlet'''/xml/hosts".
Review and agree the licence agreement.
* Confirm this is working by opening the URL '''http://servername:8080/chosen_servlet/'''
<br><br>
* If you update the hosts.xml file for a servlet you will need to either restart Apache Tomcat or stop and start the servlet from the [http://localhost:8080/manager/html Apache Tomcat Manager].
[[File:Install3.png]]
* If you want to connect to a SQL Server database using Windows Integrated Authentication, copy the appropriate version of the auth DLL from the downloaded MS JDBC drivers (e.g. mssql-jdbc_auth-12.10.0.x64.dll) into the Java bin folder.
<br>
Select the install destination.
<br><br>
[[File:Install4.png]]
<br>
Choose the appropriate install type.  
Select Full if your installing the main machine (server) which will run the interfaces and select Workstation for every other machine.
<br><br>
[[File:Install5.png]]
<br>
Amend the name of the folder shortcut if needed. Typically you would change the name if you wanted to install more than one copy of the software on the same computer.
<br><br>
[[File:Install6.png]]
<br>
Allow the installer to copy files to the destination.
<br><br>
[[File:Install7.png]]
<br>
The software is now installed.
<br><br>


== Configure Commander4j ==
=== Optional: allow other web servers to call the REST API (CORS) ===
* Setup Hosts (Database Connections)
  When commander is initially installed you will find a number of dummy database connections are already defined. You may find it easier to amend
  one of these rather than create a new connection. To manage the database connections you should run [[Setup4j]] from the Commander4j program shortcuts.


== Configuration ==
The scanner pages and the REST API are served from the same web application, so browsers need no special permission to use them. If pages served from '''another''' web server (a different host name or port) need to call the API from the browser, Tomcat must be told to allow cross-origin requests. Tomcat includes a filter for this. Add the following inside the <code>&lt;web-app&gt;</code> element of <code>conf\web.xml</code> in the Tomcat installation folder, then restart the Tomcat service:


The 1st step is to install and/or identify the database software that you plan to use with Commander4j. As mentioned previously this can be mySQL, Microsoft SQL Server (including SQL Express) or Oracle (including XE).
<pre>
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,PUT,DELETE,HEAD,OPTIONS</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With,Accept,Authorization,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
</init-param>
<init-param>
<param-name>cors.exposed.headers</param-name>
<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</pre>


== Configure Tomcat / Web Application ==
Two things to be aware of. Placing the filter in <code>conf\web.xml</code> applies it to every web application on that Tomcat, including the Tomcat manager, so only do this on a Tomcat dedicated to Commander4j. And because <code>cors.allowed.origins</code> is <code>*</code>, the filter does not pass the login cookie across origins (Tomcat's <code>cors.support.credentials</code> setting stays at its default of <code>false</code>); a page on another server can therefore only call API functions that do not need a logged-in session. To allow a logged-in session from another server, replace <code>*</code> with that server's exact origin, for example <code>http://scanner-pages.example.local:8080</code>, and add an <code>init-param</code> setting <code>cors.support.credentials</code> to <code>true</code>.
Installing the web element of Commander4j is very simple and requires you to copy 2 files from the Commander4j install directory into the Tomcat directory as follows.
Stop the Apache Tomcat service if it is running.
Copy the file  b6web.war which will be found in the Commander4j directory into  WebApps subdirectory of the Tomcat installation directory.<br >
Start the Apache Tomcat Service.  
You should then notice that the b6web directory has been created under WebApps.
Now update the list of hosts that the web application can connect to by :-
Copy (overwrite) the existing hosts file by copying  "Commander4j/xml/hosts/hosts.xml" into "Tomcat/WebApps/b4web/xml/hosts"
You can now confirm that this is working by opening the url http://servername:8080/b6web/


== Create Commander4j Services ==
== Create Commander4j Services ==
  See [[Install Interface Services]]
 
See [[Install_Interface_Services|Install Interface Services]].
 
== Install Local Middleware ==
== Install Local Middleware ==
The local middleware service handles the processing of inbound and outbound interface files between Commander4j and external systems such as an ERP. It runs as a background service on the Commander4j server machine and is configured via the [[Interface_Admin|Interface Admin]] screen within the application.
To install the interface service:
* Ensure Commander4j has been installed using the '''Full''' install option, which includes the service wrapper components.
* Open Commander4j, navigate to '''System > Interface Admin''' and verify that your interface definitions are configured correctly.
* Use the '''Assign Service''' function within the application to register the interface process as a Windows service (on Windows) or configure it as a startup process on Linux/macOS.
* Once registered, start the service and monitor the [[Interface_Log|Interface Log]] to confirm that messages are being processed correctly.
If you are using [[Middleware4j]] to transform files before they reach Commander4j, install and configure Middleware4j separately — see the [[Middleware4j]] wiki page for details.
== Install Print Queues ==
== Install Print Queues ==
Commander4j uses two distinct methods for printing, and each requires a different type of print queue to be set up on the workstation or server.
=== Standard Reports (JasperReports) ===
Standard reports — such as pallet summaries, despatch notes and audit reports — are printed using JasperReports and sent to a regular operating system print queue, exactly as you would print a document from a word processor. Any printer visible to the operating system can be used. The report type is configured in the [[Modules|Modules]] screen.
On Windows, ensure the printer is installed and visible in the Windows Printers & Scanners settings. On Linux, CUPS-managed queues are supported.
=== Barcode Labels (ZPL) ===
Barcode labels — pallet labels, case labels and sample labels — are printed by sending raw ZPL (Zebra Printer Language) commands directly to a ZPL compatible printer. This bypasses the normal print driver rendering pipeline entirely, so the label must reach the printer untouched: either through a raw / pass-through print queue, or by '''Direct Print''', where Commander4j sends the label straight to the printer's IP address and port with no operating system queue at all. Direct Print works on every platform and is described on [[Printer Queues]].
* '''Windows''' — install the printer using the [https://www.seagullscientific.com/support/downloads/drivers/ Seagull Scientific Generic Label] driver, or configure a ''Generic / Text Only'' queue. Do not use a standard Zebra Windows driver, as this will re-interpret the ZPL rather than passing it through.
* '''macOS''' — a standard macOS printer queue will not work for ZPL output. On macOS 26 and earlier a raw queue can be created through the CUPS web interface, following the guidance at [https://qz.io/docs/Setting-Up-A-Raw-Printer-in-OSX qz.io]. From macOS 27 (Golden Gate) Apple has disabled the CUPS web interface, so use Direct Print instead.
* '''Linux''' — configure a CUPS raw queue pointing at the printer's IP address and port 9100.
If a label is accidentally sent to a standard print queue rather than a raw queue, the printer will output pages of ZPL text commands instead of a label. This is harmless but confirms the queue type needs to be changed.
To use Direct Print, define the printer in [[Label Printers]] with its IP address and port and '''Direct Print''' ticked, then tick '''Direct Print''' on the label's report module in [[Modules]] and make sure Group ID, Printer Type, Language and DPI agree on both. The printer then appears in the Print Queue drop-down of the label screens. See [[Printer Queues]] for the full walk-through.
See also: [[Zebra_ZPL_Label|Zebra ZPL Label]], [[Intermec_IPL_Label|Intermec IPL Label]], [[Label_Template_Syntax|Label Template Syntax]].
[[Category:Commander4j]]

Latest revision as of 20:26, 15 October 2026

Installation covers the server-side components that an IT person sets up once the basics are working. For installing the database, the application and the database connection, follow the step-by-step Install Guide instead.

Task Page
Which file to download Downloads
Install SQL Server Express, MySQL, MariaDB or Oracle Install Database
Run the Commander4j installer (Full or Workstation) Install Commander4j
Connect Commander4j to the database and create the tables Setup4j
Log in for the first time First Login
Move to a newer version Upgrading

The sections below are only needed for hand-held scanners, ERP interfaces and barcode printers.

Install Java

The Windows and macOS installers include their own copy of Java, so a normal desktop installation needs nothing extra. You only need to install Java 25 yourself in two cases:

  • The web component (the scanner web application) on the server that runs Apache Tomcat. Tomcat itself needs Java to run.
  • The desktop application on Linux, because the Linux installer does not bundle Java.

In both cases install the JDK (not the smaller JRE). The Azul Zulu JDK 25 from https://www.azul.com/downloads/?package=jdk#zulu is recommended; on Windows choose the .msi installer and tick the option to set JAVA_HOME, which the Tomcat installer looks for.

Note that the web application should be installed on a nominated server machine and not on workstations.

Install Tomcat 11.x

Apache Tomcat 11 is required for the web component. Download it from the Apache Tomcat site. On Windows choose the 32-bit/64-bit Windows Service Installer so that Tomcat runs as a service and starts with the machine. The installer asks for the Java location: point it at the JDK you installed above.

Configure Tomcat / Web Application

The web component of Commander4j is a single file, c4j_commander4j_web.war, included with every release from version 12.75 onwards (it replaced the three separate web applications of earlier releases, which are listed below for sites that still run them). It contains the scanner pages and the REST API they use.

The servlet (.war) files shown below are intended to work on Zebra Mobile Computers which have the Zebra Enterprise Browser installed.

Servlet Purpose Environment Notes
c4j_commander4j_web.war Pallet Transactions, Quality Grading, Issue / Return Any Mobile Browser * Recommended from 12.75
c4j_web_react.war Pallet Transactions Any Mobile Browser Earlier releases
c4j_web_WS.war Quality — Product Grading Any Mobile Browser Earlier releases; only needed for Quality Control
c4j_web_Issue.war Issue Pallets to Order & Location Tablet Mobile Browser Earlier releases; Issue/Return of Stock

Installing the web element of Commander4j is straightforward and requires copying files from the Commander4j install directory into the Tomcat directory:

  • Stop the Apache Tomcat service if it is running.
  • Copy the file chosen_servlet.war from the Commander4j directory into the WebApps subdirectory of the Tomcat installation directory.
  • Start the Apache Tomcat service.
  • You should then notice that the chosen_servlet directory has been created under WebApps.
  • Update the list of hosts the web application can connect to by copying "Commander4j/xml/hosts/hosts.xml" into "Tomcat/WebApps/chosen_servlet/xml/hosts".
  • Confirm this is working by opening the URL http://servername:8080/chosen_servlet/
  • If you update the hosts.xml file for a servlet you will need to either restart Apache Tomcat or stop and start the servlet from the Apache Tomcat Manager.
  • If you want to connect to a SQL Server database using Windows Integrated Authentication, copy the appropriate version of the auth DLL from the downloaded MS JDBC drivers (e.g. mssql-jdbc_auth-12.10.0.x64.dll) into the Java bin folder.

Optional: allow other web servers to call the REST API (CORS)

The scanner pages and the REST API are served from the same web application, so browsers need no special permission to use them. If pages served from another web server (a different host name or port) need to call the API from the browser, Tomcat must be told to allow cross-origin requests. Tomcat includes a filter for this. Add the following inside the <web-app> element of conf\web.xml in the Tomcat installation folder, then restart the Tomcat service:

<filter>
	<filter-name>CorsFilter</filter-name>
	<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
	<init-param>
		<param-name>cors.allowed.origins</param-name>
		<param-value>*</param-value>
	</init-param>
	<init-param>
		<param-name>cors.allowed.methods</param-name>
		<param-value>GET,POST,PUT,DELETE,HEAD,OPTIONS</param-value>
	</init-param>
	<init-param>
		<param-name>cors.allowed.headers</param-name>
		<param-value>Content-Type,X-Requested-With,Accept,Authorization,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
	</init-param>
	<init-param>
		<param-name>cors.exposed.headers</param-name>
		<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
	</init-param>
</filter>
<filter-mapping>
	<filter-name>CorsFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>

Two things to be aware of. Placing the filter in conf\web.xml applies it to every web application on that Tomcat, including the Tomcat manager, so only do this on a Tomcat dedicated to Commander4j. And because cors.allowed.origins is *, the filter does not pass the login cookie across origins (Tomcat's cors.support.credentials setting stays at its default of false); a page on another server can therefore only call API functions that do not need a logged-in session. To allow a logged-in session from another server, replace * with that server's exact origin, for example http://scanner-pages.example.local:8080, and add an init-param setting cors.support.credentials to true.

Create Commander4j Services

See Install Interface Services.

Install Local Middleware

The local middleware service handles the processing of inbound and outbound interface files between Commander4j and external systems such as an ERP. It runs as a background service on the Commander4j server machine and is configured via the Interface Admin screen within the application.

To install the interface service:

  • Ensure Commander4j has been installed using the Full install option, which includes the service wrapper components.
  • Open Commander4j, navigate to System > Interface Admin and verify that your interface definitions are configured correctly.
  • Use the Assign Service function within the application to register the interface process as a Windows service (on Windows) or configure it as a startup process on Linux/macOS.
  • Once registered, start the service and monitor the Interface Log to confirm that messages are being processed correctly.

If you are using Middleware4j to transform files before they reach Commander4j, install and configure Middleware4j separately — see the Middleware4j wiki page for details.

Install Print Queues

Commander4j uses two distinct methods for printing, and each requires a different type of print queue to be set up on the workstation or server.

Standard Reports (JasperReports)

Standard reports — such as pallet summaries, despatch notes and audit reports — are printed using JasperReports and sent to a regular operating system print queue, exactly as you would print a document from a word processor. Any printer visible to the operating system can be used. The report type is configured in the Modules screen.

On Windows, ensure the printer is installed and visible in the Windows Printers & Scanners settings. On Linux, CUPS-managed queues are supported.

Barcode Labels (ZPL)

Barcode labels — pallet labels, case labels and sample labels — are printed by sending raw ZPL (Zebra Printer Language) commands directly to a ZPL compatible printer. This bypasses the normal print driver rendering pipeline entirely, so the label must reach the printer untouched: either through a raw / pass-through print queue, or by Direct Print, where Commander4j sends the label straight to the printer's IP address and port with no operating system queue at all. Direct Print works on every platform and is described on Printer Queues.

  • Windows — install the printer using the Seagull Scientific Generic Label driver, or configure a Generic / Text Only queue. Do not use a standard Zebra Windows driver, as this will re-interpret the ZPL rather than passing it through.
  • macOS — a standard macOS printer queue will not work for ZPL output. On macOS 26 and earlier a raw queue can be created through the CUPS web interface, following the guidance at qz.io. From macOS 27 (Golden Gate) Apple has disabled the CUPS web interface, so use Direct Print instead.
  • Linux — configure a CUPS raw queue pointing at the printer's IP address and port 9100.

If a label is accidentally sent to a standard print queue rather than a raw queue, the printer will output pages of ZPL text commands instead of a label. This is harmless but confirms the queue type needs to be changed.

To use Direct Print, define the printer in Label Printers with its IP address and port and Direct Print ticked, then tick Direct Print on the label's report module in Modules and make sure Group ID, Printer Type, Language and DPI agree on both. The printer then appears in the Print Queue drop-down of the label screens. See Printer Queues for the full walk-through.

See also: Zebra ZPL Label, Intermec IPL Label, Label Template Syntax.