Start jWebSocket Server as .jar

This section describes how to use the jWebSocket Server on the various operating systems including Windows, Mac OS and Linux. This topic will be interesting for you especially when you want to evaluate jWebSocket or when you are a developer and intend to develop new client software based upon the jWebSocket Server. The jWebSocketServerBundle-<version>.jar includes all required libraries and provides the ready-to-use folder structure. The jWebSocket Server can easily be started from the shell or command line window without any installation or special configuration.

Like all normal desktop applications the jWebSocket Server is terminated when you log off the system. Thus for production systems it is recommended to use either the jWebSocket Service (for Windows) or the jWebSocket Web Application (for all operating systems). Please refer to the bundled versions in the download section.

Prerequisites on the Server

The jWebSocket Server is based on pure Java technology. For your server please ensure that you have the Java Runtime Environment (JRE) 1.6 or higher installed and that the JAVA_HOME environment variable refers to the root folder of this Java installation. If not, you can get it here. For Windows environments, we recommend to add the path to java.exe into your PATH environment variable. If not, you may need to adjust the provided start batch or script. Please also ensure that the JWEBSOCKET_HOME and JWEBSOCKET_EE_HOME environment variables refer to the root folder of the jWebSocket installation as described below.

Download, Install and Run jWebSocket as stand-alone WebSocket Server

To set up the jWebSocket server please follow these instructions:

  1. Download the jWebSocket Server Package (jWebSocketServer-<version>.zip) from the download area which includes the jWebSocketServer-<version>.jar, all required libraries and jWebSocketServer-<version>.bat from the download section to this folder.
  2. Unpack the archive into folder of your choice (e.g. /opt for Unix/Linux environments or c:\program files\ for Windows environments). The archive contains a jWebSocket-<version> folder which is the root folder for the jWebSocket server. The folder structure below is described here.
  3. Set the JWEBSOCKET_HOME environment variable to refer to the jWebSocket root folder, this is the jWebSocket-<version> folder. Also after version 1.0, please set the JWEBSOCKET_EE_HOME environment variable pointing to that same folder, so you can use some of our enterprise edition functionalities, don't forget the back slash at the end of the variable value, for example, this is my environment configuration in Windows looks as follows:

    Find tips how to persist environment variable for Mac OSX here, for Linux you'll find it here and for windows you will find it here.
  4. For Windows environments please start the jWebSocketServer.bat batch in the \bin folder either from the command shell or the Windows Explorer. For Mac OSX there's a jWebSocketServer.command script and for Linux a is provided in the /bin folder. If the path to the java.exe is not part of your PATH environment variable, please adjust the jWebSocketServer script accordingly (please also refer to the inline documentation in the scripts).
  5. If you want to the start the jWebSocket server manually across all operating systems that support Java you can simply type java -jar bin/jWebSocketServer-<version>.jar in the shell.

Running jWebSocketServerBundle.jar in the command shell

Then you successfully ran jWebSocketServer.jar and you are able to test it, then if you want to try your server, you can play around with one of the following clients: 

jWebSocket Java Client 1.0 RC0 (b30401)

Requirements for Linux/Ubuntu

For special requirements on Ubuntu please refer to our Linux Tips page.

Command line arguments

These are the command line arguments interpreted by the jWebSocketServer-<version>.

  • -config <path_to_config_file> override default path to jWebSocket.xml. This can be used if you want to switch in order to an individual configuration file, e.g. for test purpose or to run multiple server instances on a single system.


For MS-Windows environments the jWebSocketServer-<version>.zip from the download area includes the batch file jWebSocketServer-<version>.bat.

@echo off
echo Starting the jWebSocket Server...
java -jar ..\libs\jWebSocketServerBundle-<version>.jar %1 %2 %3 %4 %5 %6 %7 %8 %9



From the Windows command line you can call jWebSocketServer.bat with the above mentioned optional arguments.

For Ubuntu environments the jWebSocketServer-<version>.zip from the download area includes the script jWebSocketServer-<version>.sh.

if [ ! -d "$JWEBSOCKET_HOME" ]; then
  JWEBSOCKET_HOME=$(cd `dirname $0` && pwd)/..

java -jar $JWEBSOCKET_HOME/libs/jWebSocketServerBundle-<version>.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

From the shell window you can run with the above mentioned optional arguments.


Learn more about WebSockets in general, get background information and gain deeper insight!

Join jWebSocket

Wether developer, designer or translator – join the jWebSocket team and grow together with our success!

Copyright © 2013 Innotrade GmbH. All rights reserved.