0% found this document useful (0 votes)
8 views15 pages

How Java Programs Work: A Guide

This document outlines the process of creating and compiling a Java program, starting from writing the code in a text document to converting it into bytecode using a Java compiler. It details the steps of saving the Java file, installing the Java Development Kit (JDK), and using command line tools to compile and run the program. The final output is a bytecode file that the computer can execute.
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)
8 views15 pages

How Java Programs Work: A Guide

This document outlines the process of creating and compiling a Java program, starting from writing the code in a text document to converting it into bytecode using a Java compiler. It details the steps of saving the Java file, installing the Java Development Kit (JDK), and using command line tools to compile and run the program. The final output is a bytecode file that the computer can execute.
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

University Of Garmian

College Of Science
Computer Science Department-1st stage
2024 - 2025

By : Mahdi Fatah Muhammed

Fundamental of Programming Language

Chapter Five
How does a Java program work?
Chapter Outline

➢ Using text document .

➢ Create Java file .

➢ Compile Java Source Code .

➢ work with the bytecode .


Create Java file
To open the Text Document program, right-click on the desktop, then New, then
Text Document. You will then need to name the file.
Create Java file
After opening the text document, type the Java code and save it with the same
class name
Create Java file
After writing the code to save the file
Create Java file
To save the file, you need to select the location of the file, then rename the file to
the class name with .Java([Link]), then save it
Java file
This is the saved file .
Java file
This is the saved file. Ready to work Although it contains Java code, the
computer does not understand it because it is still written in English and you need
to convert it to computer language for the computer to understand it. We need to
convert the source code into computer language so that the computer can
understand it .
Working Java compiler
In order for the Java compiler (javac)to work, you need to download the JDK .
⁻ Download Java (JDK) from here .
[Link]
Working Java compiler
After downloading the JDK, you need to install it. After installation, you need to
copy the javac link

after add it to edit the system environment variables .


Working Java compiler
After opening (editing the system environment variables), you need to add the
JDK link in New as follows :
Compile Source code
- You can use (CMD) or (TextPad) to view the compilation of Java code.

- To open CMD on the keyboard, press Win + R. After opening Run, press CMD
and click OK .
Compile Source code
After opening CMD.
▪ You can go to your file location via (cd)code .
▪ cd oneDrive .
▪ Then the cd desktop .
▪ You can see all files by (dir) code .
▪ Java file is compile to Bytecode through the (javac [Link] ) code.
▪ Enter .
work with the bytecode
After write (javac [Link] ) code.
▪ A new file with the same name as ours has been created, only the extension
has been changed from ( .Java) to( .Class) . This is a bytecode file that the
computer understands.
▪ Through the code (Java bytecode file name) (Java programming) we can work
with the bytecode file because the computer understands it.
▪ This is how we created and ran a program .
Tank you for your Attention!!!
Any Questions?

You might also like