Java program execution

Avindu Dharmawardhana
2 min readNov 7, 2023

--

Java is a high-level , compile, robust and object-oriented programming language.

Java used for various kind of applications. Standalone applications, web applications, enterprise applications and mobile applications.

· Standalone applications are also known as desktop applications or window-based applications. These are traditional software that we need to install on every machine. Examples of standalone application are Media player, antivirus, etc. AWT and Swing are used in Java for creating standalone applications.

· Web application is an application that runs on the server side and creates a dynamic page is called a web application. Currently, Servlet, JSP, Struts, Spring, Hibernate, JSF, etc. technologies are used for creating web applications in Java.

· Enterprise application is an application that is distributed in nature, such as banking applications, etc. is called an enterprise application. It has advantages like high-level security, load balancing, and clustering. In Java, EJB is used for creating enterprise applications.

· mobile application is an application which is created for mobile devices . Currently, Android and Java ME are used for creating mobile applications.

When we moved into the Java program execution, platform independent environment allow to run a java program in anywhere.

Java program will run based on,

1. Java runtime environment

2. API(Application programming interface)

Initially we need to install the JDK(Java development kit) included with

JVM(Java Virtual Machine) and JRE(Java Runtime Environment).

//attach ss1

Program compilation and run-time execution

public class Demo {

public static void main(String[] args) {

System.out.println("Hello java");
}

}

In the given above code snippet, displays “Hello java” after execution.

As shown in the above power shell image, javac command compiles the code that written in code editor to a byte code which understands by the JVM. JVM will move that bytecode to the JRE.

Source code compilation

As shown in the above image, bytecode will be created as a separated java class.

Run time execution of after bytecode generated

After creating the bytecode for the provided source code, JRE will convert the

Bytecode for the machine code which will understand by the machine by itself.

Summary image for the above discussed process.

--

--