在为天气 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 (将#修改为@)