| the complete webmaster | ||||
| tutorials | reviews | reference | ||
|
Getting started with JavaJava is a programming language. Folks know that all programmers are geeks who carry at least 10 pens in their shirt pockets, stays up all night, lives on soda and sweets,and has the social capabilities of a dead bug. Not! A lot of programmers are like that. But many normal people can program. On the Mac lots of graphic artists use AppleScript to automate document processing for example. The simple truth is: Programming is just telling the computer what to do. Not all that amazing is it. After all you tell the computer what you want it to do every day. Every time you click a button or select a menu option you're telling the computer what to do. A programming language is just a written language your computer can understand. So the main difference between the "programming" you currently do and Java programming is that you've got to write things down. Unfortunately for us all Java isn't as intuitive a language as we might like. As a result learning Java is going to take some effort, not as much as learning Spanish but more than falling off a ladder. The good news is that you can learn Java a step at a time. The first thing you need to do is to get the tools you need to develop a Java applet. There are several paths you can follow. One way to go is to use the Java Development Kit(JDK) supplied, for free, by Sun or some other vendor(Apple provides the MRJ for the Mac for example and other groups provide the same functionality for Linux etc). The JDK contains the minimal tools you need to use to create a Java program. Another path is to buy a commercial tool, such as Symantecs Visual Cafe, which makes developing Java easier. For example if you use the JDK you'll use a text editor to write the code on the other hand a commercial tool provides a special text editor which color codes key words in Java and auto formats the code so it's easy to read. Key Word: A word which has a special definition in Java. One Java keyword is "if". You'll use the if keyword to tell Java to make decisions. For example if the credit card is valid then ship the order. In addition commercial tools provide tools that help you track down problems and some even provide what's called a Rapid Application Development(RAD) environment. In a RAD tool you can rapidly--surprise surprise--develop applets and applications with a minimal amount of programming. In a RAD tool, which I'll cover in more detail in future columns, you can build useful applets without having to understand all of the details of Java. For right now though lets look at what we can get for free. The first place to go is the Sun site where you can download the JDK. There are links there for all of the various third party ports as well so no matter what computer you're working with you'll find what you need to get started with Java. I'm not going to walk you through installing and using the JDK because the process is different for every operating system. You should read the documentation that comes with the JDK for your platform and make sure that you've installed the JDK correctly. In general the JDK has several components. The ones of interest to you right now are AppletViewer: This tool lets you run applets without using a browser Java Virtual Machine(JVM): This is a piece of code that converts your Java instructions into actions by your computer. Compiler: This converts the text you write into something the Java Virtual Machine can understand. Essentially it translates what you write into something a computer can understand. The general approach is that you write your code with a text editor, if you use a word processor make sure you save the file as text only because the special characters that word processors put in the files will confuse the Compiler, then you compile the file with the compiler and run it with the AppletViewer which uses the JVM to actually run the code. On command line machines, such as UNIX or MS-DOS, you would type something like javac name_of_file.java to compile the file, and then java name_of_file to run it, as an application. One thing to note is that a Java source code file always ends with .Java and the name of the file must be the name of the public class in the file--we'll talk more about classes in future installments. Also note that all compiled files end with .class so hello_world.java compiles into hello_world.class. When you compile a file full of Java code you've written the compiler leaves the.java file alone and creates a new file full of stuff the JVM can understand. Right now you might take some time running some of the examples that come with the JDK. Next time I'll show you a very simple applet that'll get you started on the road to Java guruhood.
NEXT: Your first Java applet! Author: tom trinko More articles
about Java |
| write for us | about us | advertise |
Copyright 1997, 1998 A Big Lime. All rights reserved.