NUGGET Jump Start
This nugget briefly describes what Java is and how it works.
Java is a programming language.
It is a programming language in the same way that C is a programming language and COBOL is a programming language and BASIC is a programming language. People write programs in Java.
Do the letters 'J' 'A' 'V' 'A' stand for anything? -- No.
The name was chosen purely on the value of its connotations. The language was not always called Java. When the creator of the language, James Gosling, came to the moment of giving it a name, he looked up from his computer and there stood a large oak tree outside his window. This being sufficient inspiration, he named the language Oak. The language was known as Oak from 1991 to 1994. Then in 1994 the name did not survive a trademark search and was dropped in favor of the name Java.
James was not looking to create a new language when his project began. He was simply looking to find a way for programs to run unchanged on a wide variety of computers.
He set out to create a compiler and environment that would enable C++ programs to run on incompatible computer platforms without having to be recompiled. As he progressed, he found that his task would be much easier if he could modify some of the conventions of C++. As he made modifications to C++, the Java language was born.
Although it is considered a new language, Java syntax is close to
the syntax of C++. Notice the similarity of conventions between the
Java program on the left and the C++ program on the right.
The primary difference between the two programs is that the Java program defines the main() function inside the class definition, whereas the C++ program defines it outside the class.
Also notice that Java variables are allocated with the new
operator but they are not declared as pointer variables.
The most distinctive feature of the new language is the way a Java program runs on a computer.
When conventional program runs, it provides the computer's chip with a sequence of instructions to perform. When a Java program runs, it does not have direct contact with the chip. Instead, its instructions are made available to another program that is pretending to be the computer's chip. The pretending program relays the instructions to the real chip and the task is executed.
This intermediate program is part of the Java system. Some people
call it a Virtual Machine (VM) program because it stands in the place
of the real machine. Other people call it a Java Interpreter because it
translates the instructions of a Java program into instructions that
the real chip can understand.
Figure 1: Java Virtual Machine
One might wonder at this point, why the Java system has placed this translation step between their programs and the computer's processor. Wouldn't it be more efficient to have the programs talk directly to the chip? Yes, it would.
Why does the Java system include this extra step? This layer is added to provide a way for Java programs to move from computer to computer and run as well on the first computer as on the next. This means that a compiled Java program can be copied to a Sun workstation, to an IBM compatible PC, and to a PowerPC Macintosh and it will run on each platform without modification.
This is possible because Java programs are only in contact with the Java Virtual Machine -- not with the real machine. When a Java program runs on a Sun computer, the VM program on the Sun translates the Java instructions into instructions for the SPARC chip. When the program runs on a PC, the VM on the PC translates them into Intel commands and the VM on the Mac translates them into PowerPC commands. On each platform, the commands reached the real computer and were carried out. But the Java program did not need to be recompiled.
So, Java is just a programming language. What makes it special is
the way it runs on a computer. As a Java program runs, its commands
are being interpreted and passed along to the computer's processor.
This extra step allows Java programs to run unchanged on a wide variety
As the Java language was taking shape, the popularity of the Internet was exploding.
Leading the charge was the very popular World Wide Web mechanism for sharing documents. Web documents (also known as Web pages) made reference to other Web pages by specifying a special tag within the document that included the Internet address and name of the target document. This type of linking between Web pages created a Web of interrelated text documents across the globe.
The Java team wanted to leverage the Web mechanism for passing text documents between computers. Since Java programs could run on a wide variety of computers without needing modifications, Java programs could be shared in the same was that text documents are shared on the Web.
To demonstrate the potential of this program sharing, the Java team decided to write a new Web browser program which they called HotJava. Although this Web browser was written in Java, that is not what made it special. HotJava was special because it implemented a new tag so that Web pages could fetch a Java program across the Web and it included the Java Virtual Machine as part of the browser so that Java programs could run once they arrived.
These features cause a Web browser to become a fetcher of Web pages and a fetcher of Java programs. When a Web page arrives, the browser checks to see if the new applet tag has been specified. If it has, the browser fetches the requested Java program (applet). When the Java applet arrives, the browser uses its Virtual Machine to run the applet and dedicates a section of the Web page as a window within which the applet can draw and accept key strokes.
This adds a new dimension to distributed processing. Now graphic
intensive services can be requested across the World Wide Web. This
has become very popular. A common use of this capability is to
request an animation program that flashes several pictures on the
screen in rapid succession creating the sense of motion. By creating
links to programs like these, Web pages come alive with cartoon
figures waving to the user, horses running, and text dancing.
Figure 2: HotJava Web Browser
HotJava was the first Java Enabled Web browser. After HotJava established the potential of communicating Java programs across the Web infrastructure, other Web browser companies decided to make their browsers Java Enabled.
The two early leaders to apply this technology to their browsers were Netscape and Microsoft. Netscape was the earliest adopter of Java technology with their Navigator browser. They also provided most of the funding that allowed the Java team to bring this new technology to the mainstream. When Microsoft saw the potential of Java, they made a number of adjustments in their product strategy that allowed them to create a Java Enabled browser called the Internet Explorer (or IE).
Now it is a consumer requirement for Web browsers to include Java technology. Licensing fees from companies that build Java into their browsers continue to make it possible for Sun computers to offer the Java Developer Toolkit (JDK) at no charge to the general public.
As browser companies embraced Java technology, Sun computers decided
to place the HotJava on hold and rely on other companies to build Java
Enabled browsers. This move enabled Sun to focus on bringing Java to
its first production release.
Java is a programming language that blends the strengths of several programming languages.
Programming in this new environment is simpler in many ways than programming in other languages. Beginners find Java easier to learn than C. This is probably because they do not need to learn to use pointers. Yet the Java syntax is close enough to C that it seems familiar to most programmers.
Java has the object oriented benefits of C++, yet it has removed some of the more awkward rules in C++.
Java makes use of a dynamic memory area of classes and objects and runs on a Virtual Machine like Smalltalk. Yet Java syntax can be grasped more quickly than Smalltalk syntax.
With Java, the programmer enjoys the stability of a Virtual Machine
and the familiarity of a C/C++ programming syntax.
by Noel Enete . . . www.enete.com . . . email@example.com