在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jcefmaven/jcefmaven开源软件地址(OpenSource Url):https://github.com/jcefmaven/jcefmaven开源编程语言(OpenSource Language):Java 84.3%开源软件介绍(OpenSource Introduction):JCEF MAVENIndependent project to produce maven artifacts for the JCef projectbitbucket or githubVisit the JCEF repo at
|
amd64, arm64, i386, arm | |
amd64, arm64, i386 | |
amd64, arm64 |
Use with Maven:
<dependency>
<groupId>me.friwi</groupId>
<artifactId>jcefmaven</artifactId>
<version>100.0.14.3</version>
</dependency>
Use with Gradle:
implementation 'me.friwi:jcefmaven:100.0.14.3'
You can find the most recent versions of the artifacts on the releases page of this repository. Alongside each release is also a table with platforms that have been tested. If you have tested a platform and build combination that has not been tested before (using the sample app), make sure to open a new issue to share your findings!
Once you found a version you want to use, include it as a dependency into your project. An example include for Maven and Gradle can be seen above. This will only include the base jcef library and jogl in your project. Natives will be downloaded and extracted on first run. If you want to skip downloading and instead bundle the natives, include the native artifacts in your project dependencies. You can see all of them here. It is recommended to only include one bundle per build though, as each bundle is ~100MB. If you wish to include them, make sure you export one build per platform!
Once you added your dependencies, you need to fire up jcefmaven in your code. No worries, it's not complicated!
//Create a new CefAppBuilder instance
CefAppBuilder builder = new CefAppBuilder();
//Configure the builder instance
builder.setInstallDir(new File("jcef-bundle")); //Default
builder.setProgressHandler(new ConsoleProgressHandler()); //Default
builder.addJcefArgs("--disable-gpu"); //Just an example
builder.getCefSettings().windowless_rendering_enabled = true; //Default - select OSR mode
//Set an app handler. Do not use CefApp.addAppHandler(...), it will break your code on MacOSX!
builder.setAppHandler(new MavenCefAppHandlerAdapter(){...});
//Build a CefApp instance using the configuration above
CefApp app = builder.build();
From there, continue to write your app using jcef as you are used to. You can call builder.build()
as many times as you want. It is even thread-safe while initializing (will pause threads and return when initialization was completed).
If you need some code examples to create your first app, have a look at the tests on this repository or at the sample app.
If you want to get the current platform as determined by jcefmaven (e.g. to disable osr on win-arm64), you can use:
EnumPlatform platform = EnumPlatform.getCurrentPlatform();
EnumOS os = platform.getOs();
If you want to obtain version information, you can use:
//Provides build version data. Requires build_meta.json to be on classpath.
CefBuildInfo buildInfo = CefBuildInfo.fromClasspath();
//Provides JCEF version data. You can call this after initialization.
CefVersion cefVersion = cefApp.getVersion();
CefApp.addAppHandler(...)
should not be used. Use builder.setAppHandler(...)
instead (requires a CefMavenAppHandlerAdapter
)To use on MacOSX, add the following JVM flags:
--add-opens java.desktop/sun.awt=ALL-UNNAMED
--add-opens java.desktop/sun.lwawt=ALL-UNNAMED
--add-opens java.desktop/sun.lwawt.macosx=ALL-UNNAMED
To use OSR (off-screen render) mode, add these flags for JOGL:
--add-exports java.base/java.lang=ALL-UNNAMED
--add-exports java.desktop/sun.awt=ALL-UNNAMED
--add-exports java.desktop/sun.java2d=ALL-UNNAMED
Please only report bugs here that are related to the maven artifacts. Please report bugs in JCEF/CEF to the corresponding repository on Bitbucket.
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论