Skip to main content
Windward

Linux: Running the Java Engine in Linux

Overviewengine-wiki-logo.png

Explains how to install and use the Windward Java Engine in Linux.  This tutorial specifically uses Ubuntu 16.04.2, but the steps should work on any Linux variant with some additional steps.

Goal

After completing this tutorial you will have installed the Windward Java Engine on a Linux system, and have a working knowledge of running Java programs that use the engine.

Video

Software Used & Requirements

Operating System Ubuntu 16.0.4.2 LTS
Memory 3.5 GB
Disk Space 40 GB
Java Development Kit OpenJDK 8
Platform Microsoft Hyper-V Virtual Machine

 

Instructions

Install xRDP (Optional for RDP remote access)

This process is optional but allows you to install a remote desktop client to access your Unix system from a Microsoft RDP connection.

Step 1 - Install xRDP Package from the Ubuntu Repository using APT

  • Login to your Linux system and open an terminal window
  • Execute the command below to install the xRDP package using apt from the Ubuntu package repository
$ sudo apt-get install xrdp

Step 2 - Install an alternative desktop

$ sudo apt-get update
$ sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon

Step 3 - Configure xRDP using newly created alternative desktop

$ sudo sed -i.bak '/fi/a #xrdp multiple users configuration \n mate-session \n' /etc/xrdp/startwm.sh

Step 4 - Obtain the IP address and use the IP to remote into the Linux Virtual Machine

$ hostname -i

Install the JDK

The Windward Java Engine requires a JDK (Java Development Kit) in order to operate compile and run the Java code.  

Step 1 - Install the JDK using apt from the Ubuntu repository

  • Login to your Linux system and open an terminal window and elevate to a root user
$ sudo -i
  • Execute the command below to install openjdk-8-jdk
# sudo apt-get install openjdk-8-jdk

 

Note: The Oracle JDK isn't available in the default repositories on some systems, which is why OpenJDK is used here.  Further guides available on the web with instructions to setup and retrieve the correct PPA repositories to obtain the Oracle JDK.

 

For other Linux systems; Debian, Fedora, or others; this command will be different.  Consult your package manager documentation for your Linux distribution for details on how to retrieve and install your JDK of choice.

Download & Setup the Engine

The Windward Java Engine is available from the Windward Software Downloads page.  Download the Java Engine ZIP file using the wget command below.

Step 1 - Use wget to download the Windward Java Engine ZIP file

  • Open a terminal window and elevate to a root user
$ sudo -i
  • Execute the wget command below
# wget http://windwardwebsitestorage.blob.core.windows.net/windwardsoftware/downloads/SetupWindwardReportsJava.zip

Step 2 - Extract the Java Engine ZIP file to /opt/windward

In this step we will create a directory /opt/windward and assign your user ownership and extract the ZIP file.  Replace $USERNAME$ with your user name in the commands below.

 

  • Create /opt/windward
# sudo mkdir /opt/windward
  • Assign ownership /opt/windward to your user
# sudo chown $USERNAME$ /opt/windward
  • Unzip SetupWindwardReportsJava.zip to /opt/windward
# unzip SetupWindwardReportsJava.zip -d /opt/windward

Step 2 - Copy the Windward Java Engine JAR files to the Java installation location

  • Copy the JAR files in /opt/windward/jars to /usr/share/java
# sudo cp /opt/windward/jars/* /usr/share/java

Step 3 - Update your Java CLASSPATH to the /usr/share/java directory

Java's CLASSPATH is an environment variable that directs Java to the location of JAR files that can be executed system wide. 
 
  • Make a backup of your current environment setup
# sudo cp /etc/environment /etc/environment.bk
  • Add all Windward JAR files in /usr/share/java to your environment file
# printf "CLASSPATH=\".:/usr/share/java/*\"\n" | sudo tee -a /etc/environment
  • Add all Windward JAR files to your CLASSPATH
# export CLASSPATH=.:/usr/share/java/*

Test Your Installation by Running a Sample Report

Step 1 - Enter your Windward Java Engine license key

Enter the Java Engine license key you received via email from Windward in your WindwardReports.properties file.  The sample will not run without a proper license key entered.  Vim will be the text editor used in the example to enter the license key.  If you need addition details on commands available in Vim, use this resource.

  • Navigate to the Java Engine BasicCommandLine sample directory
# cd /opt/windward/demo/Samples/Java/BasicCommandLine
  • Choose the sample that reflects the datasource you want to test.  This example will use an XML datasource.
# cd /BasicXml
  • Edit WindwardReports.properties and paster your license key after license=
# sudo gedit WindwardReports.properties
  • Copy WindwardReports.properties file to /src
# cp -r /opt/windward/WindwardReports.properties /opt/windward/demo/Samples/Java/BasicCommandLine/BasicXml/src

Step 2 - Copy Data folder to /src and Create the report output directory

  • Copy BasicCommandLine/BasicXml/data to /src
# cp -r /opt/windward/demo/Samples/Java/BasicCommandLine/BasicXml/data /opt/windward/demo/Samples/Java/BasicCommandLine/BasicXml/src
  • Create the report output directory out
# mkdir out

Step 3 - Compile and Run the BasicCommandLine sample report

  • Compile BasicCommandLine file RunReport.java
# javac RunReport.java
  • Run the sample code to generate your report
# java RunReport ../samples/InvoiceTemplate.docx Invoice.pdf -xml ../samples/Order.xml.

Step 4 - Your generated report

Your generated report will be the filename report.pdf located in the /out directory.  Open this report in your PDF viewer of choice to view it.

Additional Information

The RunReport command supports each datasource and has many options.  If you would like to see all options you can pass into RunReport, simply type the command below.

# java RunReport

You can also open RunReport.java or RunReportXml.java in a Java IDE or text editor to review and extend the code yourself. This is the first step to making your own Windward Java Engine application.

What's Next

We set up the Windward Java Engine in a Linux installation here.  Now you can move on to set up a Java servlet with Tomcat 6 and our Servlet sample!

  • Was this article helpful?