Link
Skip to main content

How to build JPedal from source

Customers with an OEM license have access to the JPedal source code. If you do not have an OEM license, you can purchase one here.

This page shows you how to build JPedal from source.

Step 1 - Download the source JAR

Visit www.idrsolutions.com/jpedal/download and select ‘Download Customer Source Code’.

Once downloaded, rename the file and change the file extension from .jar to .zip.

Step 2 - Set up the directory structure

Create the directory src/main/java and move org and com into java. Your directory structure should look like this:

src
└── main
    └── java
        ├── com
        │   ├── formdev
        │   └── idrsolutions
        └── org
            └── jpedal

You may delete the META-INF directory.

This can also be quickly achieved using commands:

Windows:

mkdir "src\main\java" && move "org" "src\main\java" && move "com" "src\main\java" && rmdir /S /Q "META-INF"

Unix:

mkdir -p "src/main/java" && mv "org" "src/main/java" && mv "com" "src/main/java" && rm -r "META-INF"

Step 3 - Create the project

It is possible to build from the source JAR using any build tool, however we recommend using Maven.

Alongside the src directory, create a pom.xml file with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.idrsolutions</groupId>
    <artifactId>jpedal</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <java.version>17</java.version>
        <openjfx.version>11</openjfx.version>
        <flatlaf.version>3.0</flatlaf.version>
        <tika.version>2.6.0</tika.version>
        <jar-plugin.version>3.3.0</jar-plugin.version>
        <resources-plugin.version>3.0.2</resources-plugin.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${resources-plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy-resource-one</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/classes</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/java</directory>
                                    <includes>
                                        <include>**/*.class</include>
                                        <include>**/*.xml</include>
                                        <include>**/*.properties</include>
                                        <include>**/res/**</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${jar-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.jpedal.examples.JPedal</mainClass>
                        </manifest>
                    </archive>
                    <includes>
                        <include>**/*.class</include>
                        <include>**/*.xml</include>
                        <include>**/*.properties</include>
                        <include>**/res/**</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <scope>provided</scope>
            <artifactId>javafx-controls</artifactId>
            <version>${openjfx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <scope>provided</scope>
            <artifactId>javafx-swing</artifactId>
            <version>${openjfx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <scope>provided</scope>
            <artifactId>javafx-base</artifactId>
            <version>${openjfx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <scope>provided</scope>
            <artifactId>javafx-graphics</artifactId>
            <version>${openjfx.version}</version>
        </dependency>
        <dependency>
            <groupId>com.formdev</groupId>
            <artifactId>flatlaf</artifactId>
            <version>${flatlaf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <scope>provided</scope>
            <artifactId>tika-core</artifactId>
            <version>${tika.version}</version>
        </dependency>
    </dependencies>
</project>

Your project should look like this:

root
├── src
│   └── ...
└── pom.xml

Step 4 - Build

Run Maven to build the project and create a JAR:

mvn clean install

The result will be in the target directory.

Confirm the build was successful by running the JPedal viewer:

cd target
java -jar jpedal-1.0-SNAPSHOT.jar --view

Get started with JPedal in 3 steps

  1. Fill in the form to download the trial jar →
  2. Copy the code snippets as instructed on the next page
  3. Build your solution using our docs

Learn more about JPedal

Start Your Free Trial


Customer Downloads

Select Download