This project includes two main parts:
- File Upload/Download System: A client-server application that allows clients to upload, download, rename, delete, and synchronize files with a server.
- Computation Server: A client-server application that provides basic computation services like addition and sorting of integers.
Both parts leverage Java RMI (Remote Method Invocation) to facilitate communication between the client and the server.
- Upload files from client to server.
- Download files from server to client.
- Rename files on the server.
- Delete files on the server.
- Synchronize files between client and server.
- Add two integers.
- Sort a list of integers.
- Latest JDK (Java Development Kit). Download here
- (Optional) Any IDE (Integrated Development Environment) for Java development.
-
Download and install the latest JDK.
-
Verify the installation by running the following command in Command Prompt:
java --version
The output should resemble:
java 21.0.2 2024-01-16 LTS Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58) Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing)
-
Clone the repository:
git clone https://github.com/meggitt/JavaRMI.git cd JavaRMI
- Install an IDE such as Eclipse or IntelliJ IDEA.
- Configure the IDE for Java development.
-
Compile and Run Server
-
Navigate to the
Server
directory insideFileUpload
. -
Execute the following commands to compile and run the server:
javac Product.java javac ProductImpl.java javac Server.java java Server
-
-
Compile and Run Client
-
Navigate to the
Client
directory insideFileUpload
. -
Execute the following commands to compile the client:
javac Product.java javac Client.java
-
-
Client Operations
-
Open a new command prompt tab.
-
Navigate to the
Client
directory and execute the following commands:java Client UPLOAD example.txt # Uploads example.txt to server_folder java Client DOWNLOAD example.txt # Downloads example.txt to client_folder (downloaded_example.txt) java Client # Synchronizes files (needs further inputs) java Client RENAME example.txt exampleNew.txt # Renames example.txt to exampleNew.txt on server
-
-
Compile and Run Server
-
Navigate to the
AddSort
directory. -
Execute the following commands to compile and run the server:
javac ComputationServer.java javac ComputationServerImpl.java javac Server.java java Server
-
-
Compile and Run Client
-
Navigate to the
AddSort
directory. -
Execute the following command to compile the client:
javac Client.java
-
-
Client Operations
-
Open a new command prompt tab.
-
Navigate to the
AddSort
directory and execute the following commands:java Client ADD 4 5 # Adds integers 4 and 5 java Client SORT 3 6 1 33 35 # Sorts integers 3, 6, 1, 33, 35
-
-
Install and Configure Java
- Install Java support in Visual Studio Code.
-
Run Server and Client
- Open the respective folders in VSC.
- Click on
Terminal -> New Terminal
for each of the server and client directories. - Execute the same commands as mentioned above for CMD execution.
- UPLOAD: Uploads a file from the client to the server.
- DOWNLOAD: Downloads a file from the server to the client.
- RENAME: Renames a file on the server.
- DELETE: Deletes a file on the server.
- SYNC: Synchronizes files between the client and the server.
- ADD: Adds two integers.
- SORT: Sorts a list of integers.
Contributions are welcome! Please create an issue or submit a pull request with your changes.