Skip to content

Java console application that consumes REST APIs to fetch real-time weather data using HttpClient and Gson.

Notifications You must be signed in to change notification settings

EfeAdak/java-weather-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Weather App 🌤️

A simple Java console application that fetches real-time weather data using an external REST API.

Features

  • Fetches coordinates of a city using Geocoding API
  • Retrieves current temperature and wind speed
  • Handles HTTP status codes properly
  • Uses custom exception handling
  • Clean service-based architecture

Technologies

  • Java 17+
  • java.net.http.HttpClient
  • Gson (JSON parsing)
  • REST APIs (Open-Meteo)

How It Works

  1. User enters a city name
  2. Application fetches latitude and longitude
  3. Weather data is retrieved using coordinates
  4. Current temperature and wind speed are displayed

Example Output

---- NOW ---- Temperature: 12.7 °C Wind speed: 22.5 km/h Time: 2026-01-27T12:45

Architecture

  • WeatherApp → Application entry point
  • GeoService → City to coordinates
  • WeatherService → Weather data fetching
  • Model classes → JSON mapping
  • ApiException → Custom error handling

Notes

This project was built to practice:

  • REST API consumption in Java
  • JSON parsing with Gson
  • Exception handling
  • Clean code principles

About

Java console application that consumes REST APIs to fetch real-time weather data using HttpClient and Gson.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages