【问题标题】:How can i get this jar/api into my project我怎样才能把这个 jar/api 放到我的项目中
【发布时间】:2020-08-21 09:00:04
【问题描述】:

Github:https://github.com/huymluu/yandex-translate-api

我想在我的项目中使用这个 API,因为我尝试了多个适用于 java 的 Yandex API 包装器,尽管我得到了这个错误:java.lang.ClassNotFoundException: yandexAPI.YandexException(https://github.com/Bumbleboss/yandexTranslate_api 这个错误是我在使用那个项目时得到的。)。所以我的问题是,我该如何修复错误,或者从项目https://github.com/huymluu/yandex-translate-api制作一个 jar,这样我就可以在我的项目中尝试了!谢谢!

代码:

public String Translate(String text){

        String translatedText = "";
        YandexAPI api = new YandexAPI("APIKEY");


        try {
            translatedText = (api.getYandexResponse(text, YandexLanguage.Dutch).getText().get(0));
        } catch (YandexException e) {
            e.printStackTrace();
        }


        return translatedText;

    }

【问题讨论】:

    标签: java api github jar yandex


    【解决方案1】:

    在github的下载部分有"Latest version"这里你可以下载yandexTranslate_api-1.4-withDependencies。您需要将其导入您的库中。如果您使用 Eclipse here 是方法。

    【讨论】:

    • 谢谢!虽然我已经完成了这个(Intellij),但我下载了一个将它添加到我的项目中的依赖项并创建了这个代码。(看看主帖),它没有显示任何想法和编译时的错误,尽管当我运行它,它会在控制台中抛出错误。
    猜你喜欢
    • 1970-01-01
    • 2020-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-14
    • 2011-08-20
    • 2017-05-25
    • 2018-04-28
    相关资源
    最近更新 更多