1

我有 JXBrowser 的免费评估许可证,并且一直按照 IntelliJ 的说明(https://jxbrowser.support.teamdev.com/support/solutions/articles/9000012869-jxbrowser-in-intellij-idea)获取 HelloWorld 示例启动并运行:

import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserCore;
import com.teamdev.jxbrowser.chromium.internal.Environment;
import com.teamdev.jxbrowser.chromium.javafx.BrowserView;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class HelloWorld extends Application {
    @Override
    public void init() throws Exception {
        // On Mac OS X Chromium engine must be initialized in non-UI thread.
        if (Environment.isMac()) {
            BrowserCore.initialize();
        }
    }

    @Override
    public void start(Stage primaryStage) {
        Browser browser = new Browser();
        BrowserView browserView = new BrowserView(browser);

        StackPane pane = new StackPane();
        pane.getChildren().add(browserView);
        Scene scene = new Scene(pane, 500, 400);
        primaryStage.setTitle("JxBrowser: JavaFX - Hello World");
        primaryStage.setScene(scene);
        primaryStage.show();

        browser.loadHTML("<html><body><h1>Hello World!</h1></body></html>");
    }

    public static void main(String[] args) {
        launch(args);
    }
}

所有 jxbrowser 东西和 license.jar 都添加到项目依赖项中,但我仍然得到

Exception in Application init method
Exception in thread "main" java.lang.RuntimeException: Exception in    Application init method
    at     com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:912)
    at     com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ExceptionInInitializerError
    at com.teamdev.jxbrowser.chromium.internal.ipc.IPC.getDefault(SourceFile:44)
    at com.teamdev.jxbrowser.chromium.BrowserCore.initialize(SourceFile:51)
    at JXBrowserApp.init(JXBrowserApp.java:15)
    at         com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:841)
... 2 more
Caused by: java.lang.RuntimeException: JxBrowser license check failed: No valid license found.

我正在使用 OS X El Capitan 版本 10.11.4 和 IntelliJ 版本 2016.1.3 和 java 8u101。

任何知道问题可能是什么或如何解决它的人?

4

2 回答 2

0

I suppose the reason is that this free JxBrowser 30-days evaluation license has been expired.

于 2016-09-30T15:44:27.323 回答
0

license.jar适用于旧版本的 JX Browser (version 6)。对于7.1 版license.jar不使用。相反,许可证密钥将插入代码本身:

Engine engine = Engine.newInstance(EngineOptions.newBuilder(RenderingMode.OFF_SCREEN)
    .licenseKey("1BNDHFSC1FTA7A76VKWRRM8IRYEAL48AT20PIS26JQO0CK3H6Y0P58QPVB084Y1K4IU98T").build());
于 2019-10-06T05:59:14.713 回答