This page describes how to add JxBrowser to a Gradle project.

Repository

JxBrowser is distributed via the repository hosted by TeamDev. Please add the following repository reference to your build.gradle:

repositories {
   // The repository for JxBrowser binaries.
   maven { url = 'http://maven.teamdev.com/repository/products' }
}

Version Variable

We recommend to define a variable for the version of JxBrowser used in the project. The following sections reference such a variable.

ext {
    jxBrowserVersion = '7.0'
}

However, it is not required, and you can have the version referenced in-place because most likely you are going to have only one dependency.

Dependencies

Cross-Platform

To add JxBrowser library that works on Windows, macOS, and Linux, please add the following code:

dependencies {
   compile "com.teamdev.jxbrowser:jxbrowser-cross-platform:${jxBrowserVersion}"
}

Platform-Specific

If you need JxBrowser JAR files only for a specific platform, you can use the appropriate dependency as described below.

If your Java application runs only on Windows and macOS platforms, and you do not need Linux dependency, you can include only Windows and macOS dependencies.

Windows 32-bit

dependencies {
    compile "com.teamdev.jxbrowser:jxbrowser-win32:${jxBrowserVersion}"
}

Windows 64-bit

dependencies {
    compile "com.teamdev.jxbrowser:jxbrowser-win64:${jxBrowserVersion}"
}

macOS 64-bit

dependencies {
    compile "com.teamdev.jxbrowser:jxbrowser-mac:${jxBrowserVersion}"
}

Linux 64-bit

dependencies {
    compile "com.teamdev.jxbrowser:jxbrowser-linux64:${jxBrowserVersion}"
}

Adding Product License

In order to work JxBrowser needs a valid product license available in Java program classpath. Here is the code snippet that adds a license file placed in the root directory of the project:

depenencies {
    compile files("$rootDir/license.jar")
}

Summary

Here is the complete code of build.gradle:

buildscript {
    repositories {
        jcenter() // or other repositories that your project use.
    }
}

ext {
    jxBrowserVersion = '7.0'
}

subprojects {
    apply plugin: 'java'

    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    repositories {
        jcenter()

        // The repository for JxBrowser and other TeamDev products.
        maven { url = 'http://maven.teamdev.com/repository/products' }
    }

    dependencies {
        // Cross-platform
        compile "com.teamdev.jxbrowser:jxbrowser-cross-platform:${jxBrowserVersion}"

        // Windows 32-bit
        // compile "com.teamdev.jxbrowser:jxbrowser-win32:${jxBrowserVersion}"

        // Windows 64-bit
        // compile "com.teamdev.jxbrowser:jxbrowser-win64:${jxBrowserVersion}"

        // macOS 64-bit
        // compile "com.teamdev.jxbrowser:jxbrowser-mac:${jxBrowserVersion}"

        // Linux 64-bit
        // compile "com.teamdev.jxbrowser:jxbrowser-linux64:${jxBrowserVersion}"

        // JxBrowser license
        compile files("$rootDir/license.jar")
    }
}
Go Top