How to integrate online editors into your own web site on Java


To integrate ONLYOFFICE online editors into your own website on Java you need to download and install ONLYOFFICE editors on your local server and use the Java Example for their integration.

You can choose any appropriate way how to run the Java example code. We will show how to run the Java code using the Apache Tomcat web server.

The integration examples are used to demonstrate document editors functions and the ways to connect Document Server to your own application. DO NOT USE these examples on your own server without PROPER CODE MODIFICATIONS!

This guide will show you the sequence of actions to integrate the editors successfully.

First, download the ONLYOFFICE Editors (the ONLYOFFICE Document Server).

See the detailed guide to learn how to install Document Server for Windows or for Linux.

Download the Java Example from our site.

You need to connnect the editors to your web site. For that specify the path to the editors installation in the \src\main\resources\ file:

files.docservice.url.converter=https://documentserver/ConvertService.ashx files.docservice.url.tempstorage=https://documentserver/ResourceService.ashx files.docservice.url.api=https://documentserver/web-apps/apps/api/documents/api.js files.docservice.url.preloader=https://documentserver/web-apps/apps/api/documents/cache-scripts.html

where the documentserver is the name of the server with the ONLYOFFICE Document Server installed.

If you want to experiment with the editor configuration, modify the parameters it the \src\main\webapp\editor.jsp file.

To run the Java example code you will need to install the Java version appropriate for your OS and web server Apache Tomcat:

  1. After you have installed Java in Windows, you must set the JAVA_HOME environment variable to point to the Java installation directory.

    Find out where Java is installed. If you didn't change the path during installation, it will be something like this:

    C:\Program Files\Java\jdk1.8.0_65

    In Windows 7 right click My Computer and select Properties, then click Advanced.

    In Windows 8 go to Control Panel -> System -> Advanced System Settings.

    Click the Environment Variables button.

    Under System Variables, click New.

    In the Variable Name field, enter:

    JAVA_HOME if you installed the JDK (Java Development Kit) or JRE_HOME if you installed the JRE (Java Runtime Environment).

    In the Variable Value field, enter your JDK or JRE installation path, for example C:\Program Files\Java\jdk1.8.0_65.

    Check if the variable created successfully by echo command in the Command Prompt:

    echo %JAVA_HOME%
  2. Run the Command Prompt. Change the current directory for the Apache Tomcat installation directory:

    cd /d C:\Apache Tomcat\apache-tomcat-7.0.67\bin
  3. Use the bin startup.bat script to start Apache Tomcat:


    You will see the new Tomcat console window displayed that provides the information and mesages about Tomcat startup:

    Test your Tomcat installation using the address in a web browser:


    If everything is correct, you will see the Tomcat web page in the browser as shown below.

  1. Open Tomcat Web Application Manager by clicking Manager App:

  2. Tomcat Web Application Manager will request the username and the password:

    For that you will need to specify user data in tomcat-users.xml file in the Apache Tomcat installation folder. Define the manager-gui user role, specify the user name and password values:

        <role rolename="manager-gui"/>
        <user username="tomcat" password="tomcat" roles="manager-gui"/>
  3. Upload the Java project in Tomcat Web Application Manager. For that click Choose File in the WAR file to deploy section and find the .war file in the Java project folder, then click Deploy.

  4. You will see the project in the Application List:

  5. Click the link with the application name to run it.

In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of documentserver in the configuration files. And you must also make sure that the Document Server in its turn has access to the server with the example installed with the address which you specify instead of in the configuration files.

If you integrated the editors successfully the result should look like the demo preview on our site.