220 likes | 319 Views
Getting Set-up to Develop. Java 2 Version 1.3. Agenda. Step One and Two - Support Website and Mailing List Download an Editor for Java and Install It Enter a Java Program with the Editor Download "Thinking In Java" Code Examples and the book in HTML and check them out
E N D
Getting Set-up to Develop Java 2 Version 1.3
Agenda • Step One and Two - Support Website and Mailing List • Download an Editor for Java and Install It • Enter a Java Program with the Editor • Download "Thinking In Java" Code Examples and the book in HTML and check them out • Browse the Book and check out the Code Examples • Download a Java Systems Development Kit and set it up • Compile and Run a Java Program • Download the Sun Documentation • Browse the Sun Documentation
Steps One and Two • Go to: • http://www.awoolf.com/javaclass/index.htm • Click on: The First Step, Getting Set-up • Get on javaclass Mailing List
What You Will Need • A 32 bit Windows Platform • Windows 95 / 98 / 2000 / NT 4.0 • About 160 MB of Free Disk Space • An Hour plus the download time for 60MB
Java Software Development Kit JDK From http://java.sun.com/
Your IDE(Integrated Development Enviroment) • The Big Players • Forte for Java • Borland Jbuilder 4 • WebGain VisualCafe • Oricle Jdeveloper • Metrowerks CodeWarrior Professional • Our Basic Choice • TextPad
Get and Install TextPad • Go To http://www.textpad.com/ • Download The Free Evaluation Copy • The last time I checked TextPad cost $27. The evaluation copy just asked if you wanted to buy every hour or so of use. Pay the $27 and it will stop asking. • Install It
TextPad Preferences • TextPad is a general text editor but you would like it to assume that you are typing Java if you are entering a new file so it can help you with the syntax. • On the Configure menu select "Preferences" • In the Preferences dialog select "File" • Set the default file extension to "java"
Enter the Java Program // HelloDate.java import java.util.*; public class HelloDate { public static void main(String[] args) { System.out.println("Hello, It's: "); System.out.println(new Date()); } } From Bruce Eckel's Thinking in Java, 2nd Edition, Page 119-120
Save the Java Program • Create the directories: • C:\tij • C:\tij\my and • C:\tij\my\C02 • Save the program in the C:\tij\my\C02 directory with the file name HelloDate.java • tij is short for Thinking In Java, where we will put stuff Bruce Eckel's book "Thinking In Java" • my is a directory where you will put your work • C02 is where we will put your work from Chapter 2 and the program you just typed is from Chapter 2.
Get Bruce Eckel's Book and Code Examples • Go to http://www.bruceeckel.com/ • Under the title "Book and Book Support" fine and follow the Book Download Links • Pick One • You are looking for 6 zip files for Thinking in Java, 2nd Edition (only about 1.5MB total) • Download all 6 • Expand the 2 code files into C:\tij • Expand the 4 book(html) files into C:\tij\book
Check Out the Book • With your web browser open the file • C:\tij\book\SimpleContents.html • Bookmark the file • Browse Chapter 2 Everything is an Object • Find the class HelloDate in Chapter 2.
Check Out the Code Examples • With TextPad open the file • C:\tij\C02\HelloDate.javaThis is the same stuff you typed intoC:\tij\my\C02\HelloDate.javaIf later you have problems with your working copy ofHelloDate.javayou can compare it with the downloaded version from the book. • In general leave the downloaded files unchanged. Copy things you want to change to the C:\tij\my\... directory to edit and change.
Get and Setup Java 2 SDK • http://java.sun.com/j2se/1.3/download-windows.html • Download Java 2 SDK, v 1.3.0 Software for Windows 95 / 98 / 2000 / NT 4.0 (about 30MB to download) • Run the install program • Let it install into C:\jdk1.3
Set PATH and CLASSPATH • Add to PATH string • C:\jdk1.3\bin; ... (or something like it) This lets Windose find java.exe when you type java in a command window • Set CLASSPATH string to • .;C:\jdk1.3\bin;C:\tij (or something like it) "." lets Java find your program in the current directory "C:\jdk1.3\bin" lets Java find the Java libraries "C:\tij" lets Java find Libraries provided with Thinking In Java
Lets Compile and Run HelloDate • From the Windose Start Menu>Programs open a Command Prompt • Make the current directory C:\tij\my\C02 • Can be done with cd C:\tij\my\C02 • Compile the program in HelloDate.java • Can be done with javac HelloDate.java The compiled program will be in HelloDate.class • Run HelloDate.class • Can be done with java HelloDate • When done Close the Command window it will not be needed for a while.
Lets Compile and Run HelloDateAgain • Open HelloDate.java in TextPad • Compile the program HelloDate.java • Do it with Compile Java on the Tools menu (or Ctrl+1) The compiled program will be in HelloDate.class • Run HelloDate.class • Do it with Run Java Application on the Tools menu (or Ctrl+2) • When done Close the Command window and TextPad it will not be needed for a while.
Get Sun Documentation • Go to http://java.sun.com/j2se/1.3/docs.html • Download JavaTM 2 SDK Docs - HTML Format (about 23MB) • Unzip it to C: • We want to put it inC:\jdk1.3\docs. In the internal paths in the zip file will add the\jdk1.3\docs
Exploring Sun Documentation • Start your browser and open the fileC:\jdk1.3.0\docs\index.html • Bookmark the page • Click on the API & Language link • Click on the Java 2 Platform API Specification link • Use Index to find "Date - class java.util.Date" • Click on the link Date and read a bit about Date
Exploring Sun Documentation (Cont.) • In the upper left browser frame there is a list of Packages. Find java.lang and click on it. • Now the lower left frame in the browser will have a list of Interfaces, Classes, Exceptions and Errors in the java.lang Package. • In the lower left frame find the Class "String" and click on it. • Now the large frame on the right will provide details about the String Class. Spend some time reading the details but don't expect to understand much.
Exploring Sun Documentation (Cont.) • In the upper left browser frame near the top click on All Classes. • Now the lower left frame in the browser will have a list of all the Classes and Interfaces that are included with Java. You will be able to build additional classes and use those provided to build your Java Systems. • In the lower left frame scroll down the list and take a guess at how many classes (and interfaces) are provided. • If you see a class name you can't resist click on it and see the description to the right.