如果您的团队目前使用 JxBrowser,需要迁移到 Fuzio,这篇指南将帮助您顺利完成迁移。

由于 Fuzio 与 JxBrowser 保持了一致的 API 签名和功能体系,业务逻辑代码无需修改。整个迁移的核心操作可以归纳为三步:

  1. 替换 Maven 仓库地址与依赖坐标
  2. 全局替换包路径(com.teamdev.jxbrowser → tech.fuzio)
  3. 更新 License Key 等系统属性名

对于大多数项目,整个迁移过程可以在 30 分钟内 完成。以下是每个步骤的详细说明。

替换 Maven 仓库与依赖坐标 

Fuzio 使用自建 Maven 仓库分发。

Gradle 

// ============ 迁移前(JxBrowser) ============

plugins {
   id("com.teamdev.jxbrowser") version "2.0.0"  // 移除此插件
}

dependencies {
   implementation(jxbrowser.currentPlatform)
   implementation(jxbrowser.swing)
}

// ============ 迁移后(Fuzio) ============

repositories {
   mavenCentral()
   maven("https://jiku.mycloudrepo.io/public/repositories/releases")
}

dependencies {
   implementation("tech.fuzio:fuzio-cross-platform:${fuzioVersion}")
   implementation("tech.fuzio:fuzio-swing:${fuzioVersion}")
}

完整的 Gradle 项目配置请参阅 Fuzio Gradle 配置指南。

Maven 

<!-- ============ 迁移前(JxBrowser) ============ -->

<repositories>
   <repository>
       <id>jxbrowser</id>
       <url>https://europe-maven.pkg.dev/jxbrowser/releases</url>
   </repository>
</repositories>

<dependencies>
   <dependency>
       <groupId>com.teamdev.jxbrowser</groupId>
       <artifactId>jxbrowser-cross-platform</artifactId>
       <version>${jxbrowserVersion}</version>
       <type>pom</type>
   </dependency>
   <dependency>
       <groupId>com.teamdev.jxbrowser</groupId>
       <artifactId>jxbrowser-swing</artifactId>
       <version>${jxbrowserVersion}</version>
   </dependency>
</dependencies>

<!-- ============ 迁移后(Fuzio) ============ -->

<repositories>
   <repository>
       <id>fuzio</id>
       <url>https://jiku.mycloudrepo.io/public/repositories/releases</url>
   </repository>
</repositories>

<dependencies>
   <dependency>
       <groupId>tech.fuzio</groupId>
       <artifactId>fuzio-cross-platform</artifactId>
       <version>${fuzioVersion}</version>
       <type>pom</type>
   </dependency>
   <dependency>
       <groupId>tech.fuzio</groupId>
       <artifactId>fuzio-swing</artifactId>
       <version>${fuzioVersion}</version>
   </dependency>
</dependencies>

完整的 Maven 项目配置请参阅 Fuzio Maven 配置指南。

平台 Chromium JAR 对照表 

如果您没有使用 cross-platform 依赖,而是直接引用特定平台的 Chromium JAR,以下是对照表:

JxBrowserFuzio平台
jxbrowser-win32fuzio-win32Windows 32-bit
jxbrowser-win64fuzio-win64Windows 64-bit
jxbrowser-win64-armfuzio-win64-armWindows ARM 64-bit
jxbrowser-macfuzio-macmacOS x64
jxbrowser-mac-armfuzio-mac-armmacOS Apple Silicon
jxbrowser-linux64fuzio-linux64Linux x64
jxbrowser-linux64-armfuzio-linux64-armLinux ARM 64-bit
—fuzio-linux64-loongLinux LoongArch 64-bit

Fuzio 额外提供了 fuzio-linux64-loong(龙芯 LoongArch 架构),这是 JxBrowser 不支持的平台。如果您的应用需要运行在龙芯硬件上,添加此依赖即可。

全局替换 import 路径 

在整个项目中执行全局查找替换:

com.teamdev.jxbrowser  →  tech.fuzio

例如:

// 迁移前
import com.teamdev.jxbrowser.engine.Engine;

// 迁移后
import tech.fuzio.engine.Engine;

替换后,所有类名、方法签名、接口均保持不变——您的业务逻辑代码无需任何修改。

替换许可证配置 

系统属性方式 

// 迁移前(JxBrowser)
System.setProperty("jxbrowser.license.key", "your_license_key");

// 迁移后(Fuzio)
System.setProperty("fuzio.license.key", "your_license_key");

JVM 启动参数方式 

# 迁移前
-Djxbrowser.license.key=your_license_key

# 迁移后
-Dfuzio.license.key=your_license_key

Engine 选项方式 

Java - 代码无需修改,licenseKey("...") 方法签名一致。

Kotlin - 需要将 JxBrowserLicense 替换为 FuzioLicense:

// 迁移前(JxBrowser)
val engine = Engine(RenderingMode.HARDWARE_ACCELERATED) {
   license = JxBrowserLicense("your_license_key")
}

// 迁移后(Fuzio)
val engine = Engine(RenderingMode.HARDWARE_ACCELERATED) {
   license = FuzioLicense("your_license_key")
}

安全建议: 避免通过 -Dfuzio.license.key 命令行参数设置密钥,因为其值可能会暴露在进程监视器、测试报告或崩溃转储中。推荐在代码中通过 System.setProperty() 或 Engine 选项设置。

其他可能需要更新的配置 

Chromium 目录 

如果您自定义了 Chromium 二进制文件的提取目录,需要更新系统属性名称:

// 迁移前(JxBrowser)
System.setProperty("jxbrowser.chromium.dir", "/path/to/chromium");

// 迁移后(Fuzio)
System.setProperty("fuzio.chromium.dir", "/path/to/chromium");

或使用 JVM 启动参数:

# 迁移前
-Djxbrowser.chromium.dir="/path/to/chromium"

# 迁移后
-Dfuzio.chromium.dir="/path/to/chromium"

通过 EngineOptions 设置的代码无需修改。

如果您没有自定义 Chromium 目录,需要注意默认路径的变化:

平台JxBrowser 默认路径Fuzio 默认路径
WindowsAppData\Local\JxBrowserAppData\Local\Fuzio
macOS用户临时目录用户临时目录
Linux用户临时目录用户临时目录

日志 

如果您配置了 JxBrowser 的日志记录,需要更新属性名称:

// 迁移前(JxBrowser)
System.setProperty("jxbrowser.logging.level", "DEBUG");
System.setProperty("jxbrowser.logging.file", "jxbrowser.log");

// 迁移后(Fuzio)
System.setProperty("fuzio.logging.level", "DEBUG");
System.setProperty("fuzio.logging.file", "fuzio.log");

或使用 JVM 启动参数:

-Dfuzio.logging.level=DEBUG
-Dfuzio.logging.file=fuzio.log

通过 API 方式配置日志的代码保持不变。

其他系统属性 

以下是常见的系统属性对照。如果您在 JxBrowser 中使用了对应的属性,请确保更新前缀:

Fuzio 系统属性用途对应 JxBrowser 属性
fuzio.license.key许可证密钥jxbrowser.license.key
fuzio.chromium.dirChromium 二进制文件目录jxbrowser.chromium.dir
fuzio.logging.level日志级别jxbrowser.logging.level
fuzio.logging.file日志文件路径jxbrowser.logging.file
fuzio.crash.dump.dir崩溃转储目录jxbrowser.crash.dump.dir
fuzio.native.input.enabled启用原生输入支持jxbrowser.native.input.enabled

快捷操作: 在项目中全局搜索 jxbrowser.(注意末尾的点),将所有系统属性前缀替换为 fuzio.。

在您的 Java 桌面应用中集成基于 Chromium 的 Fuzio 浏览器引擎。

免费试用