Java Site MenuProgramming SectionsMiscellaneous StuffConsultancy ServicesDownloadsFeedback Form


Java [Home]


What is Java then ?
How to run a Java program
So is it any good for programming ?

Some useful examples
Some of my applets

Problems getting started with Java
How have I progressed
What is J2EE ?
Java Server Pages - JSP

What is Java then ? [Top]
According to the hype, Java is an all singing, all dancing answer to the Ultimate Question of Life the Universe and Everything ! In reality it is a semi-compiled, interpreted computer programming language.

A Java program source file is run through the Java compiler to produce a byte code program file. It is not quite right to think of the byte code file as an executable program file as the contained byte code instructions (or machine code instructions if you prefer) are for the Java Virtual Machine (JVM). The JVM is a conceptual CPU and a basic operating system that exists only during the execution of the Java interpreter (not withstanding any Java silicon that has been released of course).

Java programs and WWW pages usually associate themselves with the product through the use of the Java coffee cup graphic.
[Java Logo]

So how do you run a Java program ? [Top]
To run the program you must invoke the interpreter to read and act upon the instructions in the byte code file. The interpreter mimics the actions that a real CPU would take to process the instructions. As the program's byte code file is being executed by another program, and not directly by the host machine CPU, it will inevitably run more slowly than an equivalent program written in a language that can be compiled to run directly on the CPU (say C or C++).

This performance degradation is accepted due to the portability that the Java approach allows. All that is needed to run a Java program on a platform other than the one upon which it was compiled is an interpreter and support libraries for that platform. The program source does not need to be recompiled or changed in any way.

It is this inherent portability that has made Java the talk of the town, as developers can write code on one platform and have it used on other platforms that they do not know anything about. Allegedly it was the inclusion of a Java capability in Netscape's Navigator version 2 that ignited the interest that we see now.

Is it any good for programming ? [Top]
Sun Microsystems, Java's creators, provide a huge pile of utility classes to help with creating GUI's, accessing the file system, multimedia actions, using a connected network and Web based services amongst other things. At first glance Java can seem a large and daunting language to learn, but I can certainly say it is far more straight forward to program in than, say, C++.

The language itself is syntactically similar to C with additions for objects and deletions for things like the standard libraries (these functions are provided for in the utility classes), so is simple for those of us coming from that direction. However, those of you that are coming from languages like VB are in for a bit more of a syntactic and functional shock, although the overall concepts remain roughly the same.

Due to the base functional similarity of the language to C it is extremely versatile allowing you to program easily, and at least for me, in a fairly familiar way (albeit with the added usefulness of objects). The language is available on all the popular platforms and, as far as I have so far found, totally for free too. These characteristics make the language very attractive, I would recommend it highly to those programmers striving for the re-usable code ideal.

Some useful examples [Top]
There are going to be more examples added here when something is easy to understand and is useful enough to stand by itself.

  • Image Viewer HTML Generator
    A couple of classes to generate HTML files that utilise JavaScript to easily traverse through the images in a directory.
  • XML file concatenator
    A really simple class and XSL file to concatenate XML files together using the built-in Java XSLT engine.


[Fiendish Home]


Content of this page Copyright © Robert Quince 1996 - 2005.
Site Comments