Member-only story

How to build and run your Java/Kotlin application using Gradle

Smit Thakkar
3 min readJun 3, 2024

--

First step of building a backend in Java or Kotlin is to setup your developer environment and run a “Hello world”. While it’s easy to run your first program with the help of latest IDEs, it’s difficult when you have to set it up for running your code in production.

In this blog, I cover two aspects

  1. Understanding Gradle and Java build system
  2. Execute Java package using 3 different ways
Source code -> Build -> Run

Building with Gradle

Gradle is a build tool for Java. Let’s understand some basic of building a source code.

How does your source code turns into executable?

The source code can be complied directly to an executable (machine code) or can be compiled to byte code (e.g. Java source code). If it’s an executable code then you can run it on a machine with that OS. If it’s byte code then you install another application on machine that can run the byte code (e.g. JVM for Java byte code).

In case of Java, the code is first converted to byte code. To execute a code, you first have to install Java on the machine which can execute the byte code.

Compiling vs building

--

--

Smit Thakkar
Smit Thakkar

Written by Smit Thakkar

Software Developer at DoorDash. Passionate about learning, sharing, building products and solving problems

No responses yet