What is Java?
Java is a programming system (language, library and execution environment) from Oracle. It is available in several versions and for several platforms as free downloads from Oracle's Java web site. Java has existed since 1995 and is the major language for programming web servers.
Among its strengths are that
- it is truly portable: code will run on many different platforms (Windows, Mac, Linux, Solaris, etc) without any change;
- it came along late enough to have network awareness and security built into it from the start;
- it is also recent enough to use Unicode for all of its character encoding, which means that it is straightforward to display an application's user interface in any of the world's written languages;
- it is a strongly object-oriented language, which makes for well-structured design and ease of maintenance;
- it does not allow memory manipulation with pointers and so is more robust, less subject to "memory leaks" than other mainstream languages;
- it comes with a very large library (API, Application Programming Interface) which enables developers to start from a high level without having to reinvent common capabilities;
- it has a built-in mechanism for documenting code (javadoc) so API's (both Oracle's and ours) can be reused easily by reading a standard format of documentation.
Perhaps perceived as a weakness of Java is that its source code is not fully compiled to the native code of the processor on which it is to be run. Instead it is compiled to the instruction set of an imaginary ("virtual") machine which is then interpreted immediately before execution. People worry that this results in poor performance, and so Java could not be suitable for processing massive amounts of data such as in digital images. However this is not the case, as we will demonstrate. In fact the use of intermedate "byte code", as it is called, has important benefits in the implementation of Java itself, particularly with regard to portability and security. Byte code is designed for fast interpretation and Java Virtual Machines (JVM's) are written to exploit this to the full.
- API = Application Programming Interface, which is a library of code available from some supplier.
- Byte code is the compiled form of a Java program, suitable for a JVM to interpret and run.
- Compiler converts source code to a form suitable for the JVM to execute. The compiler in the JDK is a program called javac.
- JAR = Java ARchive. This is a file format for collecting together a number of Java components (classes and other resources) for distribution with an API or a complete application. In fact the format is basically the same as ZIP, so JAR files can be unzipped and explored easily. The JDK includes a program called jar for making JAR files.
- javadoc is a tool (program) for generating API documentation from comments written in the source code.
- Java SE = Java Standard Edition - the version of Java we use for our photography application. Until recently this was known as J2SE (Java 2 Standard Edition) but Java has now (2011) moved on to version 7.
- JDK = Java Development Kit (sometimes written JSDK, Java Software Development Kit). This is the minimum required by developers, for making new Java programs. It includes the JRE.
- JRE = Java Run-time Environment. The minimum required for running Java programs. It comprises a JVM and JAR files for the API. The JRE is not sufficient for developing new code, for which you need a JDK.
- JVM = Java Virtual Machine. This is a container which runs Java code. A JVM is available as part of the JRE for each platform on which Java is available.
- Source code is what developers write, in the Java language. This is human-readable but needs to be compiled before it can be run on a computer.