Install GroupDocs.Total for Java

Note
Starting from GroupDocs.Total for Java 24.6, the JAR package is signed using a GPG signature. You can find the public key in the GPG-KEYS.txt file. Learn more about verifying signatures in the Making and verifying signatures article.

Install using Maven

All GroupDocs packages are hosted at GroupDocs Artifact Repository. You can download packages or reference GroupDocs.Total for Java API directly in your Maven project using following steps.

Tip
Download a sample Maven application that demonstrates using GroupDocs.Total for Java. You can run the application locally with mvn compile exec:java command.

Add GroupDocs Artifact Repository

Add GroupDocs Artifact Repository to your pom.xml file:

<repositories>
    <repository>
        <id>GroupDocs Artifact Repository</id>
        <name>GroupDocs Artifact Repository</name>
        <url>https://releases.groupdocs.com/java/repo/</url>
    </repository>
</repositories>

Add GroupDocs.Total as a dependency

Define GroupDocs.Total for Java API dependency in your pom.xml:

<dependencies>
    <dependency>
        <groupId>com.groupdocs</groupId>
        <artifactId>groupdocs-total</artifactId>
        <version>24.10</version> 
    </dependency>
</dependencies>

Reference in Java application

To get started, download the latest version of GroupDocs.Total for Java (JAR file) from GroupDocs Artifact Repository. Also, make sure you have Java installed.

Create application

Tip
You can download the sample application and proceed to building it.
import com.groupdocs.total.Total;
import com.groupdocs.total.options.*;

public class App {
    public static void main(String[] args) throws Exception {
        Total total = new Total("formatting.docx");
        total.view(HtmlViewOptions.forEmbeddedResources());
        total.close();
    }
}

formatting.docx is sample DOCX file that we’re going to use in this example. Click here to download it.

groupdocs-total.jar is GroupDocs.Total for Java JAR file e.g., groupdocs-total-24.10.jar.

Your folder tree should look similar to the following directory structure:

📂 java-app
 ├──App.java
 ├──formatting.docx
 └──groupdocs-total.jar

Build application

To build Java application run the command below. This command compiles the application and creates App.class file in the current directory.

javac -d . -cp ".;./groupdocs-total.jar" App.java
javac -d . -cp ".:./groupdocs-total.jar" App.java

Run application

To run the application type the command below. As a result two HTML documents will be created in the current directory for the first two pages of the document.

java -cp ".;./groupdocs-total.jar" App
java -Djava.awt.headless=true -cp ".:./groupdocs-total.jar" App

Please note that -Djava.awt.headless=true required when your Java installation does not include GUI libraries.