Java programs are stored in plain-text files and then compiled into bytecode, which is one step removed from executable code. Each platform (each hardware and operating system combination) has a Java Virtual Machine, specific to that platform, whose job is to interpret and execute the bytecode. By writing Java code for a virtual machine, rather than a specific machine, it is hoped that programmers can “write once, run anywhere.”
Programs can be written in any plain-text editor like Notepad++ (Windows) or TextWrangler (OS X). Oracle Corporation (formerly Sun Microsystems) provides free of charge a Java Development Kit (normally called the “JDK”) which comprises a compiler (
javac), an application launcher (
java), and an API documentation generator (
javadoc). (Also available is an applet viewer, which will not be discussed here.) The compiler is used to convert plain-text files (with the extension
.java) to bytecode files (with the extension
.class). The bytecode files can then be interpreted and executed by the application launcher. The compiler and application launcher are command-line tools and provide the minimum functionality necessary for code development.
In our courses, we will use instead the BlueJ integrated development environment (IDE). The IDE comprises a text editor, compiler, debugger, and a runtime environment. The integration of these tools makes easier the iterative program-development cycle of code, compile, run, and debug.
- Source code. Java programs are plain-text files written in any text editor and stored with the .java extension.
- Compilation. Using a program called a compiler, the source code is converted into bytecode with the .class extension.
- Java Virtual Machine (JVM). A program which interprets bytecode into the machine language of a particular computer processor. As each bytecode statement is interpreted, it is executed by the processor.
- Platform independence. Because JVMs are available for different computer platforms, the source code of a program can be written and compiled on one platform, such as Windows running on an Intel processor, and the resulting bytecode can be run on another platform, such as OS X running on a PowerPC processor or Android running on a Nvidia processor.
- Java Runtime Environment (JRE). The JRE is a software “environment” in which bytecode can be executed. The JRE includes the JVM and “code necessary to run Java programs, dynamically link native methods, manage memory, and handle exceptions.” (Oracle, 2010. Java Programming Environment and the Java Runtime Environment (JRE). Retrieved 2016-01-01.)
Java Development Kit
- Java Runtime Environment (JRE): Java Virtual Machine, Application Programming Interface (standard class libraries), and other components required to run Java programs.
- Java Development Kit (JDK): superset of the JRE including compilers (most notably: javac), debuggers, and the javadoc documentation generator.
- Available from Oracle Corporation.
- As part of our program development cycle, source code is written in a text editor, compiled, and then executed.
- The process of writing, compiling, and executing a program can be accomplished with individual programs:
- The process of writing, compiling, and executing a program can be accomplished within a single program called an Integrated Development Environment.
- Examples of popular IDEs include BlueJ, DrJava, and Eclipse.
- Program development is an iterative progress of coding, compiling, executing, and debugging.
[This page last updated 2020-12-23 at 12h13 Toronto local time.]
© 2007–2021 Hersch, Bear & Company Limited. All rights reserved. “Grammar Authority,” “grammarauthority.com,” “touque.ca,” and “Canada’s Thinking Cap” are trademarks of Hersch, Bear & Company Limited. All other trademarks and copyrights are the property of their respective owners.