Setup — JDK, IDE, Maven & Gradle

সেটআপ — JDK, IDE, Maven ও Gradle

Read: ~25 min Beginner 5 practice problems Live code runner

1. What You Need on Your Computer

To build real Java software, you need three kinds of tool on your machine:

  • A JDK — the Java Development Kit: compiler (javac) + runtime (java) + tools.
  • An IDE (or smart editor) — IntelliJ IDEA, VS Code, or Eclipse.
  • A build tool — Maven or Gradle, to manage dependencies and produce .jar files.
তিনটি জিনিস লাগবে — (১) JDK (Java Development Kit: compiler + runtime + tools), (২) একটি IDE (IntelliJ IDEA, VS Code, Eclipse), এবং (৩) একটি build tool (Maven বা Gradle)। ABCL TECH-এর সুবিধার্থে এই কোর্সে সব কোড সরাসরি ব্রাউজারে চালানো যাবে, কিন্তু নিজের মেশিনেও সেটআপ করে রাখা উচিত।

2. JDK vs JRE vs JVM — নামগুলো একটু বোঝা যাক

JDK — Java Development Kit javac · jar · javadoc · jlink · source code for stdlib JRE — Java Runtime Environment the library (rt.jar / modules) + tools to RUN bytecode JVM — Java Virtual Machine Figure 3.1 — JDK ⊃ JRE ⊃ JVM। Developer-কে JDK ইনস্টল করতে হয়, তাতে বাকি দুটোও ভেতরে থাকে।
JVM bytecode চালায়। JRE হলো JVM + standard library। JDK হলো JRE + compiler ও developer tools। Developer-এর জন্য JDK ইনস্টল করাই যথেষ্ট।

3. Installing a JDK — Pick an LTS Version

Always choose a Long-Term Support (LTS) release. As of 2025, the current LTS options are Java 17 and Java 21. Both receive security and stability updates for years. Free distributions we recommend:

  • Eclipse Temurin (Adoptium) — the community default, fully open.
  • Amazon Corretto — free, long-term updates.
  • Microsoft Build of OpenJDK — ships with VS Code.
  • Oracle OpenJDK — reference, 6-month cadence.
সবসময় LTS সংস্করণ নিন — Java 17 বা Java 21। বিনামূল্যে পাওয়া যায় Eclipse Temurin (Adoptium), Amazon Corretto, Microsoft build বা Oracle OpenJDK। Oracle-এর paid "Oracle JDK" (commercial) সাধারণ developer-এর জন্য দরকার নেই।
Main.java
// Every JDK exposes runtime info — run this to check yours
class Main {
    public static void main(String[] args) {
        System.out.println("Java version: " + System.getProperty("java.version"));
        System.out.println("Vendor     : " + System.getProperty("java.vendor"));
        System.out.println("OS         : " + System.getProperty("os.name"));
    }
}
Verify locally: after install, open a terminal and run java -version. You should see something like openjdk version "21.0.x". If not, your JAVA_HOME / PATH environment variable needs to be set.

4. Choose an IDE

💡 IntelliJ IDEA (সেরা)

The gold standard for Java. Free Community edition is enough for 99% of work. Best refactoring, best debugger, deep Spring Boot support.

⚡ VS Code + Java Pack

Lightweight, great for students on modest hardware. Install "Extension Pack for Java" from Microsoft for a solid one-click setup.

🧱 Eclipse

Classic, free, widely used in enterprise / government / banks. Heavier, but integrates well with large multi-module Java projects.

IDE বাছাইয়ের পরামর্শ — শিক্ষার্থী ও professional developer-এর প্রথম পছন্দ IntelliJ IDEA Community (বিনামূল্যে)। লাইটওয়েট চাইলে VS Code + Java Pack। পুরনো enterprise বা bank/গভর্নমেন্ট প্রজেক্টে এখনও Eclipse চলে।

5. The Two Commands — javac and java

Every Java build eventually calls these two:

  • javac Hello.java — compile source to bytecode (produces Hello.class).
  • java Hello — run the bytecode on the JVM.

From Java 11+, there is also a shortcut — java Hello.java compiles and runs in one step (single-file source-code mode), great for tiny scripts.

দুটি কমান্ড — javac compile করে (.java → .class), java bytecode চালায়। Java 11 থেকে java Hello.java দিয়ে সরাসরি source-ও চালানো যায় — ছোট script-এর জন্য দারুণ।
Main.java
// This entire module compiles to Main.class and runs via the JVM
class Main {
    public static void main(String[] args) {
        System.out.println("Compiled by javac, run by java.");
        System.out.println("Args count: " + args.length);
    }
}

6. Maven — Convention Over Configuration

Maven is the older (2004) and still most widely deployed Java build tool. You describe the project in a pom.xml (Project Object Model), and Maven handles compilation, dependency download, testing, and packaging.

pom.xml
<!-- Minimal pom.xml for a Java 21 project -->
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.abcltech</groupId>
  <artifactId>hello-java</artifactId>
  <version>1.0.0</version>

  <properties>
    <maven.compiler.source>21</maven.compiler.source>
    <maven.compiler.target>21</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.10.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

Typical commands:

  • mvn compile — compile source.
  • mvn test — run unit tests.
  • mvn package — build a .jar.
  • mvn clean install — wipe, rebuild, install to local repo.
Maven একটি XML-ভিত্তিক build tool। pom.xml ফাইলে প্রজেক্টের নাম, version, dependency লিখে রাখেন — mvn package command দিলে Maven .jar বানিয়ে দেয়। এর মূল আদর্শ — "convention over configuration", মানে standard folder structure ধরে ধরে চলুন, কম কনফিগ লিখুন।

7. Gradle — Programmable, Fast, Modern

Gradle is the Android default and a very popular choice for new Java/Kotlin projects. Configuration is a real program in Groovy or Kotlin DSL rather than XML — powerful, but slightly steeper.

build.gradle.kts
// Kotlin-DSL build script (build.gradle.kts)
plugins { java }

group = "com.abcltech"
version = "1.0.0"

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(21))
    }
}

repositories { mavenCentral() }

dependencies {
    testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
}

Common commands: gradle build, gradle test, gradle run, gradle clean.

Gradle Android-এর default এবং নতুন Java প্রজেক্টে খুব জনপ্রিয়। XML-এর বদলে Groovy/Kotlin DSL — মানে build script একটি সত্যিকারের প্রোগ্রাম। Incremental compilation-এর জন্য Gradle প্রায়ই Maven-এর চেয়ে দ্রুত।

8. Maven vs Gradle — Which Should You Pick?

MavenGradle
ConfigXML (pom.xml)Groovy / Kotlin DSL
EcosystemLargest, banks & enterpriseAndroid default, new projects
PerformanceGoodUsually faster (incremental)
Learning curveEasy — declarativeMedium — it's code
Best forSpring Boot, enterprise, consistencyAndroid, big multi-module, custom logic
Our pick for learners: start with Maven — its declarative structure is the easiest to reason about. Switch to Gradle when you need more flexibility.
শিক্ষার্থীদের জন্য Maven দিয়েই শুরু করুন — সোজা, declarative, বেশিরভাগ Spring Boot tutorial Maven-ভিত্তিক। Android-এ কাজ করতে হলে Gradle শিখতেই হবে, কিন্তু তার আগে Maven-এ ভিত্তি শক্ত করুন।

9. Vocabulary (শব্দভাণ্ডার)

TermMeaningবাংলায়
LTSLong-term support release (e.g. Java 17, 21).দীর্ঘমেয়াদি সাপোর্টের সংস্করণ।
JAVA_HOMEEnv var pointing to your JDK install directory.JDK ইনস্টল path, environment variable।
pom.xmlMaven's project file (XML).Maven প্রজেক্ট কনফিগ ফাইল।
build.gradle(.kts)Gradle build script.Gradle-এর build script।
ArtifactThe output of a build — a .jar file.build-এর ফলাফল — .jar।
Maven CentralThe global repository of Java libraries.Java লাইব্রেরির প্রধান repository।

10. Practice Problems

  1. Write a Java program that prints the JVM version, vendor, and OS name using System.getProperty.
    JVM-এর version, vendor এবং OS নাম print করার প্রোগ্রাম লিখুন।
    ✨ Show Answer (উত্তর দেখুন)
    Main.java
    class Main {
        public static void main(String[] args) {
            System.out.println("Java: " + System.getProperty("java.version"));
            System.out.println("Vendor: " + System.getProperty("java.vendor"));
            System.out.println("OS: " + System.getProperty("os.name"));
        }
    }
  2. Explain in one paragraph the difference between JDK, JRE, and JVM.
    JDK, JRE এবং JVM-এর পার্থক্য একটি অনুচ্ছেদে লিখুন।
    ✨ Show Answer (উত্তর দেখুন)

    Answer: The JVM is the engine that executes compiled bytecode. The JRE wraps the JVM with the standard library that Java programs rely on at runtime. The JDK wraps the JRE with the compiler (javac) and developer tools (jar, javadoc, jlink). End users only need a JRE/JVM; developers always install the JDK.

  3. Write a program that prints all command-line arguments, one per line.
    command-line-এর সব argument এক লাইন করে print করুন।
    ✨ Show Answer (উত্তর দেখুন)
    Main.java
    class Main {
        public static void main(String[] args) {
            System.out.println("Got " + args.length + " args:");
            for (String a : args) System.out.println(" - " + a);
        }
    }

    Tip: locally run with java Main arg1 arg2 arg3.

  4. Which build tool would you pick for (a) a new Spring Boot microservice and (b) a new Android app? Justify briefly.
    (ক) নতুন Spring Boot সার্ভিস এবং (খ) নতুন Android অ্যাপের জন্য কোন build tool?
    ✨ Show Answer (উত্তর দেখুন)

    Answer: (a) Maven — the Spring Initializr defaults to Maven, and most Spring docs/tutorials assume it. Declarative pom.xml is easier for teams to read. (b) Gradle — Android Studio uses Gradle exclusively; Kotlin DSL plus the Android plugin is the only sensible path.

  5. Runnable: print the current working directory and the user's home directory using system properties.
    বর্তমান working directory ও user-home print করুন।
    ✨ Show Answer (উত্তর দেখুন)
    Main.java
    class Main {
        public static void main(String[] args) {
            System.out.println("cwd : " + System.getProperty("user.dir"));
            System.out.println("home: " + System.getProperty("user.home"));
        }
    }

Summary — Module 03

Install an LTS JDK (Java 17 or 21) from Eclipse Temurin, Amazon Corretto, or Microsoft. Pick IntelliJ IDEA Community as your IDE, or VS Code + Java Pack if you want something lighter. Learn Maven first — declarative, widely used, easy to read — and pick up Gradle when Android or custom build logic requires it. Every command-line Java build still boils down to javac + java.

LTS JDK ইনস্টল করুন (Java 17/21), IntelliJ বা VS Code বেছে নিন, প্রথমে Maven শিখুন — পরে প্রয়োজন হলে Gradle। দিন শেষে সবকিছু javac + java-তেই গিয়ে ঠেকে।

Next Module → Your first Java program — the full anatomy of public static void main(String[] args).