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 = '6.24.3'
}
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 {
implementation "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 {
implementation "com.teamdev.jxbrowser:jxbrowser-win32:${jxBrowserVersion}"
}
Windows 64-bit
dependencies {
implementation "com.teamdev.jxbrowser:jxbrowser-win64:${jxBrowserVersion}"
}
macOS 64-bit
dependencies {
implementation "com.teamdev.jxbrowser:jxbrowser-mac:${jxBrowserVersion}"
}
Linux 64-bit
dependencies {
implementation "com.teamdev.jxbrowser:jxbrowser-linux64:${jxBrowserVersion}"
}
Summary
Here is the complete code of build.gradle
:
buildscript {
repositories {
jcenter() // or other repositories that your project use.
}
}
ext {
jxBrowserVersion = '6.24.3'
}
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
implementation "com.teamdev.jxbrowser:jxbrowser-cross-platform:${jxBrowserVersion}"
// Windows 32-bit
// implementation "com.teamdev.jxbrowser:jxbrowser-win32:${jxBrowserVersion}"
// Windows 64-bit
// implementation "com.teamdev.jxbrowser:jxbrowser-win64:${jxBrowserVersion}"
// macOS 64-bit
// implementation "com.teamdev.jxbrowser:jxbrowser-mac:${jxBrowserVersion}"
// Linux 64-bit
// implementation "com.teamdev.jxbrowser:jxbrowser-linux64:${jxBrowserVersion}"
}
}