Java Engineering / JAVA FUNDAMENTALS / JAV-001

Build Doctor

Explore concept graph

Praktik dan verifikasi mandiri

Project: Build Doctor

Konsep 1 / 3

Identify the Java 21 JDK, javac and java runtime and distinguish a compile-time missing symbol from runtime class loading.

In a second shell with a deliberately inconsistent JAVA_HOME, diagnose and repair the JDK mismatch without modifying the Java program.

Kasus yang berbeda dari contoh: Switch between two shell environments rather than diagnosing the IDE configuration of the example.

Bukti yang bisa kamu periksa

  • Before/after CLI JDK and Maven version outputs with a clean compile proof.

Jika ingin lanjut

Inspect dependency scopes and compare main compilation classpath to runtime classpath.

Jika terputus: Start by identifying exactly which JDK runs Maven and which JVM runs the artifact.

Konsep 2 / 3

Explain compile, runtime, test and provided Maven dependency scope using failure evidence.

Change a different library from compile to provided; demonstrate why its production code can compile yet fail when no runtime container supplies it.

Kasus yang berbeda dari contoh: Test the provided-scope runtime boundary rather than the example's test-scope compile failure.

Bukti yang bisa kamu periksa

  • POM diff and clearly separated main compile and runtime execution results.

Jika ingin lanjut

Make Java release, Maven verify and executable JAR agree.

Jika terputus: Ask whether the missing class is needed to compile code, run code or only test it.

Konsep 3 / 3

Verify a Java 21 Maven build and a runnable executable JAR without relying on IDE state.

Break a second CLI-only Java 21 project in two ways: incorrect dependency scope and missing JAR Main-Class. Repair it, demonstrate two clean mvn clean verify runs, then execute the JAR.

Kasus yang berbeda dari contoh: A combined two-defect Maven application rather than the isolated Java compiler/runtime fixture.

Bukti yang bisa kamu periksa

  • Broken/fixed POM and first failure diagnostic, repeated Maven verification output and successful java -jar startup.
  • Explicit distinction between Java fixture evidence and real Maven/JAR evidence.

Jika ingin lanjut

Use the same diagnosis pattern in Spring Boot startup, test pipelines and CI releases.

Jika terputus: Prove two things separately: clean Maven verify and executable JAR launch.

Buat proyek Maven Java 21 kecil dengan src/main/java/dev/cs101/Main.java. Gunakan satu library ketika benar-benar diperlukan (misalnya untuk formatter) dan uji scope salah secara sengaja. Catat error pertama dan akar masalahnya, bukan hanya pesan akhir dari Maven.

mvn -version
mvn clean verify
java -jar target/build-doctor-1.0.0.jar

Nama JAR contoh mengikuti artifactId dan versi POM milik lab; sesuaikan bila berbeda. Untuk setiap kegagalan, bedakan salah target release, symbol hilang saat compile, Main-Class hilang, dan kelas runtime yang tidak tersedia. Ulangi dari clean workspace, tanpa memakai IDE.

Build Doctor — Maven 21 CLI recovery

Sengaja rusak dependency scope dan konfigurasi Java atau JAR entrypoint, diagnosis compile versus runtime secara terpisah, perbaiki, lalu buktikan mvn clean verify dan executable JAR berhasil konsisten tanpa IDE.

Latihan manual — jalankan sendiri di lingkunganmu. Kriteria di bawah adalah pemeriksaan mandiri, bukan penilaian otomatis.

Kriteria selesai

  • Catat java -version, javac -version, dan mvn -version serta alasan kesesuaian toolchain Java 21.
  • Reproduksi setidaknya satu kegagalan compile atau scope yang nyata dan dokumentasikan error pertama serta koreksi POM.
  • Buktikan mvn clean verify berhasil dua kali dari clean CLI, bukan hanya dari tombol Run IDE.
  • Pastikan JAR memiliki Main-Class yang benar dan tunjukkan output java -jar yang berhasil.
  • Jika dependency eksternal dipakai, jelaskan cara runtime classpath tersedia; jangan menganggap JAR biasa adalah fat JAR.
  • Pisahkan bukti fixture JDK lokal dari bukti Maven dan executable JAR yang dijalankan sungguhan.

Kriteria verifikasi mandiri

  • Bisa menjelaskan peran JDK, JVM, javac, Maven dan --release 21.
  • Dapat membedakan compile-time missing symbol dari runtime NoClassDefFoundError.
  • Bisa menentukan compile, test, runtime atau provided berdasarkan kelas yang dibutuhkan.
  • Mampu membuktikan mvn clean verify dan java -jar melalui terminal yang sama dengan output nyata.