JDK tools
Tool Full Form Purpose Example
Compiles Java source code (.java) into bytecode javac
javac Java Compiler
(.class). [Link]
Packages multiple .class files and resources into jar cf [Link]
jar Java Archive Tool
a single .jar file. *.class
Java
Generates HTML documentation from Java javadoc
javadoc Documentation
source code comments. [Link]
Tool
Helps find and fix bugs by executing the program
jdb Java Debugger step by step, setting breakpoints, and inspecting jdb Hello
variables.
A JAR (Java ARchive) file is like a ZIP file for Java applications. It bundles all the
files your Java program needs into a single file.
Suppose your project has:
MyApp/
[Link]
[Link]
[Link]
[Link]
[Link]
If we want to distribute all of these files together we need jar. It package
everything into one file.
jar cf [Link] *.class [Link] [Link] > [Link]
Benefits of JAR :
Easy distribution : Share one file instead of many.
Organized : Keeps classes and resources together.
Portable : Can be copied and run on any system with Java.
Executable : If it contains a manifest specifying the main class, you can run it
directly.
Java Runtime Environment
JRE (Java Runtime Environment) is the software required to run Java programs.
It provides everything needed to execute a Java application, but it cannot compile
Java source code.
JRE (Java Runtime Environment) is the runtime environment used to execute Java programs.
It contains the JVM and the Java class libraries required to run Java applications
Java Class Libraries are pre-written classes provided by Java that you can use in your
programs instead of writing everything from scratch.
Think of them as a toolbox full of ready-made code.
Instead of writing your own code to print text:
[Link]("BCA General");
You use the System class from the Java class library.
Java Virtual Machine
JVM (Java Virtual Machine) is the runtime engine of Java. It loads .class files, verifies the
bytecode, executes it, manages memory through garbage collection, and uses the Java class
libraries (such as System and Math) to run Java programs.
What the JVM does
1. Loads [Link] into memory using the Class Loader.
2. Verifies the bytecode to ensure it is valid and safe.
3. Finds the entry point: