Java programming has been touted for being one of the most powerful programming languages that programmers use to develop computer applications. Since its development, many people have regarded Java programming language as a robust environment that can be used to develop programs for use in the internet as well as in individual workstations (Pancake and Christian 101). Being that Java programming language is free; many programmers have exploited the capabilities of this programming language to develop various software solutions for their own use or for commercial purposes such as mobile phone applications (Wong, Noemi, and Dana 93). Software solution written in Java consists of instructions that are executed by computers in order to perform a given action. For instance, a Java program may be written to keep track of inventory records at a local store. Regardless of the purpose of software being developed, Java program development requires Java development kit to be installed in a computer, and for the five steps to be followed in sequence. All Java program development processes consist of creation of a program, compilation of code, loading of the program into memory. Verifying the byte code and executing the program.
Java development kit
Development of a Java program requires that programmers configure their computers into the right environment using the Java development kit (Babcock 7). In order to develop any Java program, the computer to be used must have some important programs and utilities that are supplied in the Java development kit. Developed by Sun Microsystem, the Java development kit allows programmers to use various tools as such as Java loader, compiler and debugger. These tools form part of the software development kit, which defines the tools that are used collectively in program development (Babcok 7). Sun Microsoft offers the Java development kit for free and programmers can download it from the internet and install it in their computers. When installing the Java development kit, the installer copies all programs required to develop application into a folder in the installation directory of the operating system. The Java development kit forms the central prerequisite that will allow programmers to accomplish the five steps in Java program development.
Creating a Java program
Creating a Java program constitute the step that programmers go through when developing a Java program. Creating a Java program is a process that requires skills and tools that allow programmers to turn system requirements into a software solution. For instance, if a customer request a software vendor to write them a Java program, the vendor will translate the client’s requirement into software that can accomplish a given task. When programmers understand what program is to be developed, they are then required to create the program using an editor of their choice (Kuehnhausen and Victor 1709). Editor program are sometimes referred to as the editor and are used in writing Java programs. There are many editors in the market and programmers are at liberty to choose what suits them most. Using an appropriate editor, programmers can create Java programs by entering Java code into the editor and saving the file names with a .Java extension.
Creating a Java program is not possible without the use of an editor. Editors play a central role in ensuring that a Java program is written well within a given time frame. There are many editors that are in use today, and each of them works in different environments. In Windows, there number of editors such as Notepad whereas Linux has VI editor. Some of these editors have special features that enable them to correct mistakes by highlighting them or automating the insertion of some code. Most important, some editors are built into special software that is used to create Java program. Some of these programs include the NetBeans developed by Sun Microsystem, Eclipse developed by Eclipse foundation and JBuilder developed by Borland (Pancake and Christian 99). These environments allow the creation of software much more easily with increased precision, and accuracy.
When creating a Java program, programmers have a duty to develop programs that have logical flow of execution. To successfully create a Java program, programmers arrange their code in the editor in a logical process that makes use of Java methodologies. For instance, a program that will be used add two number will be written using variable, which will hold various numbers that will be added to give an output. When creating a Java program, programmers make use of Java statements that will be compiled at that next stage of development of Java program development. After writing the Java program in the editor and saving it on the disk, this program is now ready to be compiled.
Compiling a Java program
Java programs are usually compiled after they have been written and saved in a file stored on the computer disk. Writing a Java program is unique compared to other programming paradigms. This stage of Java programming is characterized by the conversion of a Java program into Java bytecodes. In this phase, the command Java also known as the Java compiler is used. The command Javac that is installed into the computer is used to compile a Java program once the Java development kit running. The Javac compiler is used at command prompt in a computer with windows operating system, shell prompt in Unix or Linux operating system or Terminal software in a Mac OS X. Regardless of the operating system used, the Javac command will compile a program written in Java into a Java class file.
In this phase, a Java compiler translates Java statement into series of byte codes that can be executed at a later stage. Byte codes are produced in order for them to be executed by the Java virtual machine, which allows Java bytecodes to be executed in any environment. The Java virtual machine also abbreviated by JVM allows Java bytecode to run in any operating system (Wong, Noemi and Dana 101). Therefore, the production of bytecodes at this phase is a necessary step in enabling a given Java program to work in any operating system as long an appropriate JVM is installed. The compilation of Java program into Java bytecodes is of fundamental importance since it makes Java programs to be portable.
Loading program into memory
Java programs are usually loaded into memory once they have been compiled. This phase of Java program development places a program written in Java into the memory where it can be executed. The processing of placing a Java program into memory is called loading because the Java virtual machine class loader is the one responsible for carrying put this phase. Once a program has been written and compiled the Java class loader is then used to place the .class files previously written into primary memory, where they can be executed by the Java virtual machine. Without this process, it is not possible for a Java class to be executed because all files must be loaded into memory for them to be executed.
The loader is responsible for loading two files into the primary memory. One of the files loaded into the memory is the .class file written containing the program’s bytecodes while the other file is a .class file, which contains files to be used by the program. The second file is loaded into memory because it provides support files for various functionalities in the program. For instance, a program that writes or reads data from a disk will require class files that tells the program how to carry out this function. Therefore, this file is loaded into the memory, in order to ensure that the program runs when executed at a later stage.
Loading of program files can be done either from the internet or a standalone computer. When an individual is developing a Java program, the program files can be saved in local disk from where it can be accessed, read and loaded into the primary memory. On the other hand, Java program development can also rely on a network infrastructure to load files into the memory. This example is very common for programs that are developed to run in the web. In addition, Java program files can be loaded from the network drive if the computer is being run in one location of the company far from where the server is located (Stieger, Anja and Martin 329).
Byte code verification
The fourth phase in the development of a Java program entails the verification of the bytecode produced from the program under development. When programs are developed in Java, it is necessary to ensure that the bytecode generated are secure and valid in order for them to be executed. This process is made possible by the Java bytecode verifier, which is located among the Java development kit files. First, the bytecode verifier examines all bytecode in detail, with emphasis on the validity of the files. For any bytecode to work in a Java program, all the bytecodes associated with the program must be valid for them to be executed appropriately. When developing a Java program, there is a possibility of creating errors associated with instance such as stack overflows, which can halt the running of the program. Because of the potential impact of errors such as stack overflows, the bytecode verifier checks the bytecodes to ensure that they have no errors (Kuehnhausen and Victor 1708).
Security in Java programming is believed to be of paramount importance. When developing a Java program, the bytecode verifier must check that the bytecode generated conforms to the security levels of the program. In some cases, programmers can create programs that violate some Java security requirements and this will be reflected in the bytecode. The danger of having bytecode with security violation rests on the potential harm that they can occur on a computer running the program. Because of the Java’s security requirement, the bytecodes verifier examines all bytecodes in detail by comparing them with some safe files. The result of this process is a bytecode that is safe to use and can be executed by the Java virtual machine without the danger of security restriction being violated. This step is one of the reasons why many people prefer developing their program in Java compared to other programming languages that have limited security restrictions.
Execution of Java’s bytecode
The execution of Java bytecode is the last phase of developing a Java program. Once the program has been created and taken through the four steps identified above, the program will be ready to be executed and specific output produced. Execution of codes is carried out by the Java virtual machine, which is responsible for converting Java bytecodes into machine specific language. This process is the most important part of the Java development process because it allows the programmers to evaluate their programs based on the output of the program. When the Java runtime environment is executing code, the process is done with each bytecode being interpreted one at time (Nguyen, Ninh-Thuan and Viet-ha 608). The output of bytecode execution is a program that performs a number of functions that were programmed during the creation of the Java program.
Execution of Java program has undergone a lot of changes with better execution strategies being developed. In recent Java development processes, the process of bytecode execution has been simplified. This has been through the use of just-in-time compiler that has the ability to process Java bytecodes as soon as they are interpreted. This is done by a Java HosSpot compiler that compiles sections of codes that are executed many times. When such code are translated before execution, the final Java program will run much more effectively as because the bytecode interpreted into the machine language will load faster and perform actions associated with it.
The output of the execution of program bytecode is based on the details of the bytecode generated from the program file. The process of execution is one of the most important phases that allows Java program to work in a particular environment. For instance, the Java virtual machines will execute a bytecode and translate it into the machine language for particular platform such as Windows or Linux where the program will be used to perform a give task.
Without doubt, Java program development is an interesting and intuitive process that entails the conversion of user requirement into bytecode that can be executed to perform a predefined task. In developing a Java program, Java statement are written into a file with a .Java extension using editors such as Notepad in Windows or VI in Linux. The Java command then takes the .Java file created and compiles it into .class file with a .class extension. This bytecode file represents tasks that are to be executed by the program. After compilation, the bytecode is then loaded into the memory of the computer. The Java bytecode verifier is then used to verify the bytecode to ensure that it is valid and safe. One this process is over, the Java virtual machine will then translate the bytecode into machine language making the program to run as expected.