Skip to content

Simple example of RMI and OpenWeatherMap API: 5 day/ 3 hour forecast

Notifications You must be signed in to change notification settings

ivkamluk/openweathermap_api_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

This is a simple example of RMI and OpenWeatherMap API

The Application can be useful for people trying to learn RMI and make a real-life application.

Pre-run initializing

  1. Sign up at OpenWeatherMap and get your API key.
  2. Select your city id at the file list_id_cities.txt (last edition was 5.04.2019)
  3. Modify these rows at the OpenWeatherMap.java file.
private	String API_KEY = "YOUR_API_KEY"; 
private	String CITY_ID = "YOUR_CITY_ID"; 
  1. Change or leave row for an accepted unit at the OpenWeatherMap.java file.
OpenWeatherMap is supporting:
  • imperial: Temperature in Fahrenheit
private String UNITS = "imperial";
  • metric: Temperature in Celsius
private String UNITS = "metric";

Steps to run the app

Put all of this repository files inside a folder.

Important! You need to have Java JDK! If you don`t have download it

First, you need to run commands for WeatherServer and only after that for WeatherClient

Windows

open cmd 
make cd to_your_folder
make cd to_src_folder

and run this WeatherServer commands

set "path=%path%;C:\Program Files\Java\jdk1.8.0_201\bin"
javac -classpath "json.jar"; Weather.java
javac -classpath "json.jar"; WeatherData.java
javac -classpath "json.jar"; OpenWeatherMap.java
javac -classpath "json.jar"; WeatherServer.java
javac -classpath "json.jar"; WeatherClient.java
start rmiregistry
java -classpath "json.jar"; WeatherServer
java -classpath "json.jar"; WeatherClient

after that open another cmd and run WeatherClient commands

java -classpath "json.jar"; WeatherClient
PAUSE

Mac and Linux

open terminal
make cd to_your_folder
make cd to_src_folder

run WeatherServer commands

javac -cp .:json.jar Weather.java
javac -cp .:json.jar WeatherData.java
javac -cp .:json.jar OpenWeatherMap.java
javac -cp .:json.jar WeatherServer.java
javac -cp .:json.jar WeatherClient.java
rmiregistry &
java -cp .:json.jar WeatherServer
java -cp .:json.jar WeatherClient

after that open another terminal window and run WeatherClient command

java -cp .:json.jar WeatherClient

In result you will have like this:

server client1 client2

About

Simple example of RMI and OpenWeatherMap API: 5 day/ 3 hour forecast

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages