---
title: "Internal Details of Java"  
description: "We are going to learn, what happens while compiling and running the java program. Moreover, we will see some question based on the program.  What happ"  
author: "ANkita gupta"  
published: 2015-05-16  
updated: 2018-02-21  
canonical: https://www.mindstick.com/blog/10888/internal-details-of-java  
category: "java"  
tags: ["java"]  
reading_time: 2 minutes  

---

# Internal Details of Java

We are going to learn, what happens while compiling and running the java program. Moreover, we will see some [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) based on the program.\

#### What happens at compile time?

At compile time, java file is compiled by Java [Compiler](https://www.mindstick.com/articles/27/just-in-time-compiler) (It does not interact with OS) and converts the java code into bytecode.

![compilation of simple java program](http://www.javatpoint.com/images/core/javacodecompile.png) \
\

---

##### \

##### What happens at Runtime?

| At runtime, following steps are performed: |
| --- |
| ![what happens at runtime when simple java program runs](http://www.javatpoint.com/images/run.JPG) |

| [Classloader](https://www.mindstick.com/forum/159683/what-is-a-classloader): is the subsystem of JVM(Java virtual m/c) that is used to load class files. Bytecode Verifier: checks the code fragments for illegal code that can violate accessright to objects. Interpreter: read bytecode stream then execute the instructions. ##### HOW TO SET PATH? The path is [required](https://www.mindstick.com/forum/160269/what-is-required-data-annotation-how-does-it-affect-model-validation) to be set for using tools such as javac, java etc. If you are saving the java source file inside the jdk/bin [directory](https://www.mindstick.com/forum/226/how-to-get-application-directory-using-c-sharp-csharp), path is not required to be set because all the tools will be available in the current directory. But If you are [having your](https://yourviews.mindstick.com/story/2357/explore-these-healthy-facts-of-having-your-dinner-early) java file outside the jdk/bin folder, it is necessary to set path of JDK. There are 2 ways to set java path: 1.[temporary](https://www.mindstick.com/forum/2292/how-to-set-temporary-path-of-jdk-in-windows) 2.[permanent](https://answers.mindstick.com/qa/50600/what-is-a-permanent-storage-in-pc) 3. 1) How to set Temporary Path of JDK in [Windows](https://www.mindstick.com/articles/311752/how-to-install-and-use-the-google-wifi-software-on-a-windows-or-mac-computer) To set the temporary path of JDK, you need to follow following steps: Open [command prompt](https://answers.mindstick.com/qa/51716/how-to-make-bootable-pendrive-using-cmd-windows-command-prompt) copy the path of jdk/bin directory write in command prompt: set path=copied_path. IN next post, will come up with permanent method. \ |
| --- |

---

Original Source: https://www.mindstick.com/blog/10888/internal-details-of-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
