0

My project is not very advanced cause I've just started programming in Java/JavaFX.

Users select country from combobox, then below in text field write a city. After pressing OK button user should receive a weather forecast for one day for the city entered. Actually names are getting correctly from inputs and sets as private fields in Weather class. I'm using weather OWM JAPIs from: https://bitbucket.org/aksinghnet/owm-japis/src. All needed libraries are added to project. (I've read that better way is to use Maven/Gradle frameworks but i'm totally green in using them).

Problem appears when method showCurrentWeather from Weather class is launched. New created object owm in line 19 causes lot of errors f.e:

Caused by: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at net.aksingh.owmjapis.core.OWM.<init>(OWM.kt)
at sample.Weather.showCurrentWeather(Weather.java:19)
at sample.Controller.searchWeather(Controller.java:30)

Weather class:

public void showCurrentWeather() throws APIException {

    OWM owm = new OWM(MyConstants.OWM_API_KEY);
    CurrentWeather cwd = owm.currentWeatherByCityName(city);
    System.out.println("City: " + cwd.getCityName());
    System.out.println("Temperature: " + cwd.getMainData().getTempMax()
            + "/" + cwd.getMainData().getTempMin() + "\'K");
}

Controller class

public void searchWeather() throws APIException {

    String selectedCountry = comboBox1.getSelectionModel().getSelectedItem().toString();
    String selectedCity = textField1.getText();
    Weather weather = new Weather(selectedCity,selectedCountry);
    weather.showCurrentWeather();
}

Any answer/advice is really appreciated.

  • Caused by: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics – duffymo Aug 03 '18 at 13:02
  • You're probably missing the dependency of that OWM library on the Kotlin standard library. – Ilya Aug 04 '18 at 20:59
  • If you open `pom-default.xml` in the `poms` directory of OWM archive distribution, you can see a list of dependencies required to use this library. It means that you have to download not only OWM, but also all these libraries. And then all their dependencies, listed in their poms. When you use a build tool like Gradle or Maven, they do this work of dependency downloading for you. – Ilya Aug 05 '18 at 11:43

0 Answers0