Getting Started with the Java SDKThe start-up of any new language can be very frustrating. However, the JDK is relatively easy to install and use - and once you get the hang of it, you should have no ongoing problems.You should have downloaded the Java JDK from "http://java.sun.com" - click on "Products & API's" on the left menu. Select Java 2 Platform, Standard Edition. Then click to select Standard Edition v 1.3 (this is the latest one). Eventually, you will get to the point where you can download the 1.3 JDK. It is about 30 megabytes, so it will take a while. http://java.sun.com Once downloaded, double click the executable to install it. Accept the default install options and directories - with stuff like this, it is better to let the install package place the software where it wants instead of trying to alter locations. Once installed, you are ready to test the installation. You need to add the java directory to the system's path. To do this, you must edit autoexec.bat and add the path to the PATH statement. To alter the path variable, first you need to know where java has been installed. To find the path to the java bin directory, run "Start/Find/Files or Folders" from the windows start menu to find the following file: javac.exe When the find is complete, you may see more than one folder (in the "In Folder" list) containing this file. The one you want should contain "...\jdk1.2.1\bin" or "...\java\bin". To be sure, you can also seach for "java.exe" and "appletviewer.exe". Choose the directory which contains all of them. This is the directory that you should set your path. To make the path work for you all the time, you should edit "autoexec.bat" and add the java path (prefaced by a semi-colon). Once you have done all this, try typing "javac xxx.java" (xxx.java is a dummy name - the file should not exist). You should get an error message saying that "I can't read: xxx.java". This means the java compiler is working, but the file (xxx.java) does not exist. If you get an error message saying "unknown command or filename" or "The name specified is not recognized as an internal or external command..." then the path variable is not yet correct. Retry the steps, above, until this test works. Once this works, you can compile a java program by typing "javac name.java", where 'name' is the name of the program. You must include the java suffix, and the name of the program must be exactly the same as the name of the primary class inside the source file. Java (including compiling) is case sensitive, so the names must match exactly. For example, a source file for a class "Welcome" must be called "Welcome.java" or you will have difficulties. Welcome.java is a small program to test your Java SDK installation. |