0% found this document useful (0 votes)
2 views3 pages

Introduction to Java and Class Path

This document provides an introduction to Java programming, explaining the components of the Java Development Kit (JDK), including the Java Compiler and Java Runtime Environment (JRE). It outlines the process of compiling and running Java programs, as well as how to set the class path using both command prompt and GUI methods. Key concepts such as bytecode, platform independence, and the execution process are also discussed.

Uploaded by

buppalaiah.svist
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Introduction to Java and Class Path

This document provides an introduction to Java programming, explaining the components of the Java Development Kit (JDK), including the Java Compiler and Java Runtime Environment (JRE). It outlines the process of compiling and running Java programs, as well as how to set the class path using both command prompt and GUI methods. Key concepts such as bytecode, platform independence, and the execution process are also discussed.

Uploaded by

buppalaiah.svist
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Introduction to Java & Class Path

Hello friends, welcome to our channel. In today's session, Im going to discuss Java programming specifically

a basic introduction to Java and how to set the class path.

To begin with, well understand the basic terminologies used in Java and how Java programs are executed.

The software used to run Java applications is called JDK, which stands for Java Development Kit. This JDK

consists of two main parts:

1. Java Compiler

2. JRE (Java Runtime Environment)

When we write a Java program, the Java Compiler compiles it and generates a .class file, also called

bytecode. This bytecode is then given to the JRE, which includes the JVM (Java Virtual Machine).

In comparison to C language, where after compilation the object code is directly executed by the operating

system, in Java, the bytecode is executed by the JVM not directly by the operating system.

Each operating system (like Windows, Linux, or Mac OS) has its own JVM, which means JVM is

OS-dependent, but the bytecode remains the same. So, the output is platform-independent, even though

JVM itself is platform-dependent. Thats why Java is considered a platform-independent language.

To summarize the execution process:

- JDK contains the compiler and JRE.

- The compiler compiles the .java file into a .class file (bytecode).

- This bytecode is given to the JVM.

Page 1
Introduction to Java & Class Path

- JVM executes it and produces the output.

How to Compile and Run a Java Program:

To compile a Java program:

javac filename.java

If there are no syntax errors, this will generate a .class file.

To run the Java program:

java filename

(Note: Do not include the .class or .java extension while executing.)

How to Set the Class Path:

Before writing and running Java programs, we must set the path so we can execute Java commands from

any location in the system.

There are two ways to set the path:

1. Using Command Prompt:

Open Command Prompt and type:

set path="C:\Program Files\Java\jdk1.8.0\bin"

2. Using GUI (System Properties):

- Right-click on This PC or My Computer and go to Properties.

- Click on Advanced system settings Environment Variables.

- Under User Variables, click New.

Page 2
Introduction to Java & Class Path

- In Variable Name, type: path

- In Variable Value, paste the Java installation path (e.g., C:\Program Files\Java\jdk1.8.0\bin) without quotes.

This completes the class path setup.

So in this session, we have learned:

- Basic Java components: JDK, JRE, JVM, bytecode

- The process of compilation and execution

- How to set the class path using both command line and GUI methods

Hope you understood the basic concepts and how to set up your system for Java programming. If you found

this helpful, please like and share the video, and dont forget to subscribe to the channel. Thank you for

watching!

Page 3

You might also like