Setup — JDK, IDE, Maven & Gradle
সেটআপ — JDK, IDE, Maven ও Gradle
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
.jarfiles.
2. JDK vs JRE vs JVM — নামগুলো একটু বোঝা যাক
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.
// 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"));
}
}
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.
5. The Two Commands — javac and java
Every Java build eventually calls these two:
javac Hello.java— compile source to bytecode (producesHello.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-এর জন্য দারুণ।
// 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.
<!-- 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.
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.
// 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.
8. Maven vs Gradle — Which Should You Pick?
| Maven | Gradle | |
|---|---|---|
| Config | XML (pom.xml) | Groovy / Kotlin DSL |
| Ecosystem | Largest, banks & enterprise | Android default, new projects |
| Performance | Good | Usually faster (incremental) |
| Learning curve | Easy — declarative | Medium — it's code |
| Best for | Spring Boot, enterprise, consistency | Android, big multi-module, custom logic |
9. Vocabulary (শব্দভাণ্ডার)
| Term | Meaning | বাংলায় |
|---|---|---|
| LTS | Long-term support release (e.g. Java 17, 21). | দীর্ঘমেয়াদি সাপোর্টের সংস্করণ। |
| JAVA_HOME | Env var pointing to your JDK install directory. | JDK ইনস্টল path, environment variable। |
| pom.xml | Maven's project file (XML). | Maven প্রজেক্ট কনফিগ ফাইল। |
| build.gradle(.kts) | Gradle build script. | Gradle-এর build script। |
| Artifact | The output of a build — a .jar file. | build-এর ফলাফল — .jar। |
| Maven Central | The global repository of Java libraries. | Java লাইব্রেরির প্রধান repository। |
10. Practice Problems
-
Write a Java program that prints the JVM version, vendor, and OS name using
System.getProperty.JVM-এর version, vendor এবং OS নাম print করার প্রোগ্রাম লিখুন।✨ Show Answer (উত্তর দেখুন)
Main.javaclass 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")); } } -
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. -
Write a program that prints all command-line arguments, one per line.command-line-এর সব argument এক লাইন করে print করুন।
✨ Show Answer (উত্তর দেখুন)
Main.javaclass 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. -
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.
-
Runnable: print the current working directory and the user's home directory using system properties.বর্তমান working directory ও user-home print করুন।
✨ Show Answer (উত্তর দেখুন)
Main.javaclass 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.
javac + java-তেই গিয়ে ঠেকে।