As we know,
* the ‘High-Level Programming Language‘ : a programming languages which are designed EASY for people to write and to understand.
included: Java, VB, C++, BASIC, FORTRAN, PASCAL, …
Unfortunately, the computer machine just can understand the MACHINE/ASSEMBLY languages….so
The ‘High-Level Programming Language’ must be translated into –> ‘Machine/Assembly Languages’
using a program called ‘COMPILER’
* ‘COMPILER‘ : a program for translating High-level programming language into Machine/Assembly language
so..when we said “we COMPILE a program” means we run a compiler program in order to translate our High-Level Language Programming into Machine/Assembly Languange.
e.g.: we compile our program file written using Visual Basic : *.BAS –> *.EXE
we compile our program file written using JAVA : *.java –> *.class
CHALLENGE for COMPILING procedure is Portability of the Compiled Program File for different Computer Systems (Operation Systems, Hardware, …) :
say if we have 3 Computer with 3 DIFFERENT SYSTEMS –> we have to INSTALL the COMPILER program in all three computers….then when we want to run the program, again we have to compile each 3 times for 3 computer…and each computer can be has different Compiled Program Files that can not be used in one program.
COMPILE in Java
Java looks the Portability giving more simplicity
so…Java introduce an additional steps in running a high-level programming languages:
commonly the steps are:
High-level programming file (‘Source Code’) — translated by COMPILER –> ‘Object Code/Program‘
High-level programming file (‘Source Code’) — translated by JAVA COMPILER –>’BYTE-CODE Program‘ (e.g: ” *.class “) …………….
then the Byte-Code Programs can be used just one program or more then one together to be run using Byte Code Interpreter — called ‘JAVA VIRTUAL MACHINE / JVM‘) –> ‘Object Code/Program‘ (Java Program)
So….the Portability of Java is:
* after compiling our Java Source Code becoming Byte-Code Program (*.java –> *.class) we can run the Byte-Code Programs in any type of Computer as long as it has been installed JVM and
also we can run a program linking more then one Byte-Code Programs (*.class) because Java system has a ‘LINKER’ that linking/connecting pieces of different byte-codes