Skip to content

Latest commit

 

History

History

java

Folders and files

README.md

gRPC Java Project setup

Overview

This is a template project for the gRPC and Protocol Buffers hands-on task in gRPC primer. It uses standard gRPC Java libraries and com.google.protobuf gradle plugin for Protocol Buffers code generation. See also: gRPC Java Quick Start

Getting Started (assuming you are on a Ubuntu AWS VM)

Install Java 17 (corretto-17) and set JAVA_HOME environment variable to point to the installation directory. Ubuntu 22.04:

sudo apt update
sudo apt install openjdk-17-jdk

Check the installation:

java -version

Run server:

./gradlew runServer

You should be able to see the server running on port 8080.

Run client (in another terminal):

./gradlew runClient

Input any string and press enter. You should see the message being sent to the server and the server responding with the same message. Logs should be printed in both client and server.

If you want to see what the generated code looks like, you can run protobuf code generation alone:

./gradlew generateProto

The generated code will be in build/generated/source/proto/main directory.