微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在为天气 API 运行以下代码后,我在使用 eclipse 的 java 中遇到错误?

如何解决在为天气 API 运行以下代码后,我在使用 eclipse 的 java 中遇到错误?

** 我正在尝试运行以下代码,该代码具有天气 api,应该告诉所选位置的天气,但出现以下错误

**


Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
    at net.aksingh.owmjapis.core.OWM.<init>(OWM.kt)
    at myCbot.main(myCbot.java:11)
Caused by: java.lang.classNotFoundException: kotlin.jvm.internal.Intrinsics
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.classLoader.loadClass(ClassLoader.java:522)
    ... 2 more

** 我收到以下 java 代码错误 **

import net.aksingh.owmjapis.core.OWM;
import net.aksingh.owmjapis.api.APIException;
import net.aksingh.owmjapis.model.CurrentWeather;

public class myCbot {

    public static void main(String[] args) throws APIException {

        // declaring object of "OWM" class
        OWM owm = new OWM("some-api-key");

        // getting current weather data for the "London" city
        CurrentWeather cwd = owm.currentWeatherByCityName("London");

        // printing city name from the retrieved data
        System.out.println("City: " + cwd.getCityName());

        // printing the max./min. temperature
        System.out.println(
                "Temperature: " + cwd.getMainData().getTempMax() + "/" + cwd.getMainData().getTempMin() + "\'K");
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。