无法将二进制api客户端导入JavaFX应用程序



我有一个JavaFX项目。

我为binanceapi客户端包安装了一个依赖项。它在我的依赖文件夹中

<dependencies>
   <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>13</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>13</version>
    </dependency>
    <dependency>
        <groupId>com.binance.sdk</groupId>
        <artifactId>binance-client</artifactId>
        <version>1.0.8-SNAPSHOT</version>
    </dependency>
</dependencies>

然而,当我去进口它。

import com.binance.client.*;

上面写着

  package com.binance.client is not visible

如果我遵循Netbeans的建议;将模块添加到模块信息";。我在模块信息中得到了这个。

module com.mycompany.btrade {
   requires javafx.controls;
   requires javafx.fxml;
   requires binance.api.client;
   opens com.mycompany.btrade to javafx.fxml;
   exports com.mycompany.btrade;
}

然而,当我运行程序时,它只是崩溃了,出现了这个错误

java.lang.module.FindException: Module binance.api.client not found, required by com.mycompany.btrade

为什么我似乎不能导入这个包。

我不确定您是否正在尝试使用binancejavaapi,如果您只使用java,这正是您想要的,或者是否确实存在其他名为com.binance.sdk.的包

根据我查看的文档,您的依赖项应该是:

    <dependency>
        <groupId>com.binance.api</groupId>
        <artifactId>binance-api-client</artifactId>
        <version>1.0.8-SNAPSHOT</version>
    </dependency>

话虽如此,我不确定如果你做出改变,版本控制是否仍然有效,但这可以解释错误:

binance.api.client not found, required by com.mycompany.btrade

因为它与依赖项所描述的包不匹配。

最新更新