【发布时间】: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