Pages

What is loading? And why loading?

Q) What is loading? And why loading?
·.exe files, .bin files, .class files are executable files contains machine or jvm code.
·All this files are stored in hard disk.
·To execute all this files by microprocessor these files from hard disk must be loaded into ram
·To load .exe files, .bin files the operating system uses static loading.
·In static loading all executable blocks are loaded into ram if all executable blocks loading is completed then execution of the program is started
·JVM loads .class files dynamically, so .class files loading is dynamic loading
·In dynamic loading 1st main class is loaded, then main function execution is started
·Based on main function lines execution if required other classes also loaded
·All classes in JVM are not loaded at the beginning of main function execution.
·Whenever main function is under execution at that time remaining classes are loaded based on requirements.     

Environment variables:
PATH: Path is a environmental variable using which we make JDK and its programs available to the local operating systems. Path of the JDK has to be mentioned in the environment variable path.
Using this environment variable path local operating system would be able to locate the programs belonging to JDK.
Ex: path: jdk\bin
CLASSPATH:
CLASSPATH is also an environment variable using which we make all the library packages and the required programs available to the JVM. Thus JVM would be locating the library packages through the environment variables CLASSPATH
Ex: jdk\lib\tools.jar;jdk\jre\lib\rt.jar
NOTE:
1.  Environment variable path would be used by local operating system and environment variable class path would be used by JVM.
2.  All the basic library packages which are required for developing a basic java application are present in “rt.jar” file. In the form of a compressed format.