JAVA

If you’ve heard of the Web, then you probably have heard about Java and how it has something to do with the Internet. In reality, it isn=t used all that much. It could be very useful, but that is all — could be. For the most part, it’s the latest rage and one of the newest buzz words.

To understand Java, you need a little background in programming. So little, in fact, that I will tell it to you right now. Any application that you have on your computer was originally many lines of computer code. This code would tell the computer to open a window, draw to the window, do some arithmetic, or even open a file. The point being, everything that a program does, is a line of code written by a programmer.

There are many different “languages” that programmers will use to write these lines of code to make a program. It’s a lot like real life languages. If someone is fluent in English and Spanish, they can write the same thing in each. All computer languages can do the same things, but are implemented differently.

For example, in the programming language BASIC, you can put something on the screen by typing: print “whatever.” In the language Pascal, you can do the same thing by typing: write(‘whatever’) . Those two commands will put the word “whatever” on the screen.

Java is another language just like BASIC or Pascal. It’s based on the C and C++ languages, though. Therefore, its syntax is different, but everything can still be done. One of the benefits of Java is that it can be made so that it doesn’t rely on a brand of computer to run.

Most computer languages are compiled (made into a program) so that they can only run on a specific operating system. If you try to run a Macintosh program on a DOS computer, it will not work. If the programmer wanted to have his program work on a different operating system, he would have to take the original code, modify it to run on a different system and recompile it. Java can be compiled in two ways. One way is like every other language, in that it can only run on one system. It can also be compiled so that it will work on any system. This is called a Java applet, while the former is simply called a Java program.

To run a Java applet, one must have a Java interpreter on their computer. The interpreter takes the Java commands and lets it run on the computer. One downside to this is that two different interpreters could make the program different in terms of speed or reliability. Generally speaking, Java applets are not very complex programs in which this would make a difference. Netscape Navigator 2.0 and later has a Java interpreter in it.

Java is great, but unless you’re a programmer, you won’t be doing anything with it. If you want to add some interesting things to your Web page, you’re not going to use Java. You’re going to use JavaScript.

Java and JavaScript are not the same thing. The only thing that they have in common is their syntax and they are both used on the Web. JavaScript is written in with HTML code. Java is written in a compiler, such as Codewarrior, and then compiled into an applet.

JavaScript is not compiled. It’s written in your HTML in the HEAD tag. Tags in the HEAD tag are formatted before the rest of the file. JavaScript is written in functions. That means that you write some code, but use it later in the file. For instance, you might want to put a message on the screen when the user presses a button. You would create the button using HTML, and when the button is pressed call the function that you already wrote in the HEAD tag.

JavaScript can add many interesting features to a Web page. Using JavaScript, it’s possible to create new pages from data given from the user. Most of all, JavaScript adds interactivity to a site. You could have a clock, the date, or even a game added to a page by only using JavaScript.

There are many resources on the Web for learning JavaScript. One of the best is at http://home.netscape.com/eng/mozilla/Gold/handbook/javascript/index.html. This is the Netscape site for JavaScript. It’s very complete and there are many other sites on the Web with ready made JavaScripts. One very nice one is the JavaScript Planet at http://www.geocities.com/SiliconValley/7116.

Java and JavaScript bring the Web to a new height of interactivity. They can make your site more visually appealing and much more useful. They do require time to learn, though. If you have any questions, and most people do, you can email me and I will help you solve your problem.


Brian Koponen (briankop@mail.idt.net)

Leave a Reply