Skip to content

Java RMI Calculator is a simple Remote Method Invocation (RMI) application implemented in Java. It enables clients to perform basic arithmetic operations remotely over a network using Java's RMI technology. The application supports addition, subtraction, multiplication, and division operations.

Notifications You must be signed in to change notification settings

Shubham-Zone/Java-RMI-Calculator

Repository files navigation

Java RMI Calculator

Java RMI Calculator

This repository contains a simple Remote Method Invocation (RMI) calculator application implemented in Java. The application allows clients to perform basic arithmetic operations remotely using RMI.

Features

  • Addition
  • Subtraction
  • Multiplication
  • Division

Getting Started

Prerequisites

  • Java Development Kit (JDK)
  • Git

Installation

  1. Clone the repository:

    git clone https://github.com/Shubham-Zone/Java-RMI-Calculator.git
  2. Compile the Java files:

    javac *.java
  3. Start the RMI registry:

    start rmiregistry
  4. Run the server:

    java CalculatorServer
  5. Run the client:

    java CalculatorClient

Usage

// Sample code for using the RMI Calculator

// Import the necessary packages
import rmi.Calculator;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class CalculatorClient {
    public static void main(String[] args) {
        try {
            // Locate the RMI registry
            Registry registry = LocateRegistry.getRegistry("localhost");

            // Look up the remote object
            Calculator calculator = (Calculator) registry.lookup("CalculatorService");

            // Perform remote operations
            double result = calculator.add(5, 3);
            System.out.println("Addition Result: " + result);
        } catch (Exception e) {
            System.err.println("Client exception: " + e.toString());
            e.printStackTrace();
        }
    }
}

Acknowledgments

  • This project is inspired by the concepts of Remote Method Invocation (RMI) in Java.

About

Java RMI Calculator is a simple Remote Method Invocation (RMI) application implemented in Java. It enables clients to perform basic arithmetic operations remotely over a network using Java's RMI technology. The application supports addition, subtraction, multiplication, and division operations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages