Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.(注意:本文中的建议仅适用于JxBrowser6,JxBrowser7相应文章请点击这里。)
Application Class Path(应用程序类路径)
In order to use JxBrowser library in your Java application you need to include all the JAR files from the lib directory of the JxBrowser distribution package into your application class path. Your application class path should look like: (为了在Java应用程序中使用JxBrowser库,您需要将JxBrowser分发包的lib目录中的所有JAR文件都包含在应用程序类路径中。您的应用程序类路径应类似于:)
java -classpath jxbrowser.jar;jxbrowser-win32.jar;jxbrowser-win64.jar;jxbrowser-mac.jar; jxbrowser-linux64.jar <your-application-class>
Note: If your application supports only Windows platform, there is no need to include the jxbrowser-mac.jar and jxbrowser-linux64.jar JAR files into your application class path.(注意:如果您的应用程序仅支持Windows平台,则无需在应用程序类路径中包含jxbrowser-mac.jar和jxbrowser-linux64.jar JAR文件。)
The jxbrowser-win32.jar, jxbrowser-win64.jar, jxbrowser-mac.jar, jxbrowser-linux64.jar libraries contain Chromium binaries for corresponding platform. At the first run JxBrowser extracts the binaries from appropriate JAR file into user’s temp directory on macOS and Linux, and AppData\Local\JxBrowser on Windows.(jxbrowser-win32.jar,jxbrowser-win64.jar,jxbrowser-mac.jar,jxbrowser-linux64.jar库包含对应平台的Chromium二进制文件。首次运行时,JxBrowser将相应的JAR文件中的二进制文件提取到macOS和Linux上用户的temp目录中,以及Windows上的AppData \ Local \ JxBrowser中。)
Maven(Maven)
In order to obtain JxBrowser JAR files using Maven you need to add TeamDev's Maven repository to the repositories section of your pom.xml file: (为了使用Maven获得JxBrowser JAR文件,您需要将TeamDev的Maven存储库添加到pom.xml文件的存储库部分:)
<repository> <id>com.teamdev</id> <url>http://maven.teamdev.com/repository/products</url> </repository>
and configure the dependency section in your pom.xml file via Cross-platform or Platform Specific dependency: (并通过跨平台或特定于平台的依赖项在pom.xml文件中配置依赖项部分:)
Cross-platform Dependency(跨平台依赖)
Add the dependency on JxBrowser cross-platform library to the dependencies section of your pom.xml file: (将对JxBrowser跨平台库的依赖项添加到pom.xml文件的依赖项部分:)
<dependency> <groupId>com.teamdev.jxbrowser</groupId> <artifactId>jxbrowser-cross-platform</artifactId> <type>pom</type> <version>6.22</version> </dependency>
The jxbrowser-cross-platform artifact contains JxBrowser JAR files for cross-platform development. It includes JxBrowser JAR files for Windows, Linux, and macOS.(jxbrowser-cross-platform工件包含用于跨平台开发的JxBrowser JAR文件。它包括适用于Windows,Linux和macOS的JxBrowser JAR文件。)
Platform Specific Dependency(特定平台依赖)
If you need JxBrowser JAR files only for a specific platform, then you can use appropriate dependency as described below:(如果只需要特定平台的JxBrowser JAR文件,则可以使用如下所述的适当依赖项:)
Windows 32-bit
<dependency> <groupId>com.teamdev.jxbrowser</groupId> <artifactId>jxbrowser-win32</artifactId> <version>6.22</version> </dependency>
Windows 64-bit
<dependency> <groupId>com.teamdev.jxbrowser</groupId> <artifactId>jxbrowser-win64</artifactId> <version>6.22</version> </dependency>
Note: if you don't know whether Windows 32-bit or 64-bit should be used in your project, then please check the article.(注意:如果您不知道项目中应使用Windows 32位还是64位,请查看本文。)
macOS(苹果系统)
<dependency> <groupId>com.teamdev.jxbrowser</groupId> <artifactId>jxbrowser-mac</artifactId> <version>6.22</version> </dependency>
Linux 64-bit (Linux 64位)
<dependency> <groupId>com.teamdev.jxbrowser</groupId> <artifactId>jxbrowser-linux64</artifactId> <version>6.22</version> </dependency>
Note: If your Java application runs only on Windows and macOS platforms, and you don't need Linux dependencies, then you can include into your pom.xml file only Windows and macOS dependencies.(注意:如果您的Java应用程序仅在Windows和macOS平台上运行,并且您不需要Linux依赖项,那么您可以在pom.xml文件中仅包含Windows和macOS依赖项。)