Table of contents
Java is a popular and highly useful programming language that was designed to be both powerful and simple. Developed by Sun Microsystems
. It is similar in style and syntax to C, C++, and C#.
Java's similarity to C ends with its syntax. Java is object oriented, and its entire concept is a change from the traditional older programming languages such as C, Pascal, and others that are oriented towards linear processing and design. In that respect, it is more similar to C++ and C# with its use of object modeling.
Java is both a compiled language and an interpreted language. The developer compiles source code (.java files) into class files (.class). When a java program is actually run, the interpreter, known as the Java Virtual Machine (JVM™) is called to interpret the byte codes that are contained in the class file or files and run the program.
What is the JVM
The Java Virtual Machine is included in all Java installations, and is required to run any Java program. The JVM is responsible for interpreting the Java program .class file being run and executing the program.
While Java is portable, the JVM is unique to the software platform on which you are running. For example, the JVM for Sun Solaris™ is different from the JVM for Microsoft Windows, Linux®, and Apple. Just about all vendors provide a JVM for their operating systems, and are available for download from the internet. A good example is Sun Microsystems, which provides JVMs for its own Solaris platform as well as Microsoft Windows and Linux.
What is the Java Platform
The Java Platform is a set of classes that is included in every Java installation, and is available to every Java program. These classes provide a vast amount of functionality and include the core classes of the language itself.
All Java classes, including the Java Platform, are organized into groups called packages. As an example of the packages that are available in the Java Platform, we discuss two packages.
The java.lang package includes the core base of the Java language. It includes the superclass called Object that defines all basic object functionality of the language. All classes in Java are a subclass of Object. The following classes of note are included in this package among others:
- Math - Class that provides math functionality.
- String - Class that provides functionality to manipulate strings.
- Number - Class that provides wrappers around primitive Java types.
- System - Class that provides an interface to system facilities.
- Thread - Class that provides information on a Java program thread.
The java.util package includes a set of utility classes. The classes provided in this package primarily revolve around handling and dealing with specific data structures. The following classes of note are included in this package among others:
- Arrays - Class that provides functionality for sorting, searching, and working with arrays.
- Collections - Class that provides functionality for working with java collections.
- Hashtable - Class that provides functionality to create and manipulate hash tables.
- LinkedList - Class that provides functionality to create and manipulate linked lists.
- Stack - Class that provides functionality to create and manipulate stacks.
These packages and classes are a small sample of what is available in the Java Platform. After you see and work with the Java development environment, you can understand how rich and robust it is.
The Java Runtime Environment
The JVM is included in the Java Runtime Environment™ (JRE™). The JRE consists of the JVM, Java core classes, and supporting files. It can be downloaded as an installable executable from an appropriate vendor website. For Windows and Linux, you can refer to the Sun Microsystems Web site for the most current installs.
One of the things to note about the JRE is that it is frequently embedded in other program installations, including Domino. Any application that uses Java as its base language, or uses Java classes in any way, needs to supply a JRE along with it at installation. Otherwise you must ensure that the JRE is installed and available separately.
You can have multiple JREs on your desktop or server, each associated with a specific application, and each isolated from each other by both the application and operating system. One of the side effects of this is that a given application can have a different level of the JRE/JVM than another. When you specifically download just the JRE from the Internet, chances are you are dealing with a unique situation in which an application or program needs it loaded separately.
The Java Development Kit
One of the applications or tools mentioned above that includes the JRE/JVM in it is the Java Development Kit (JDK™). In addition, the JDK contains all the necessary files and tools for compiling Java programs and creating your own packages.
The JDK is sometimes referred to as the Java Software Developer Kit (SDK). Like the JRE, the JDK for your OS platform can be downloaded from the proper vendor's Web site.
This primer is intended to be a brief and high level overview of Java and its capabilities. If you are inexperienced or are unfamiliar with Java, take the time to tour one or more of the many books or online tutorials to expand your knowledge of the language.
Many reference books are available on Java, both by purchase on the Internet or your local bookstore. They vary in scope and depth, from the popular "Dummies" series, "Nutshell" series, and "Teach yourself..." series, to the more high level college texts and professional publications. Some of these books are available online.
- Java in a Nutshell, by David Flanagan. Publisher: O'Reilly Media, Incorporated
- Java: How to Program, by Staff of Deitel & Associates, H. M. Deitel. Publisher: Prentice Hall
- Sams Teach Yourself Java 6 in 21 Days, by Rogers Cadenhead, Laura Lemay. Publisher: Sams
- Java For Dummies, by Barry Burd. Publisher: Wiley, John & Sons, Incorporated
- Head First Java, by Kathy Sierra, Bert Bates. Publisher: O'Reilly Media, Incorporated
Java resources, Web sites and tutorials
There are also a multitude of Web sites with a wealth of information about Java, including a lot of reference documentation on the standard Java classes and Java language itself. In addition, for the beginner, free tutorials are available on the Internet.
Sun Microsystems' Sun Developer's Network web page should be your first resource on Java information, including downloads, and has an excellent tutorial to get you started.