getting set-up to develop

22
2001 by Ashby M. Woolf Revision 2 Getting Set-up to Develop Java 2 Version 1.3

Upload: kuame-wong

Post on 31-Dec-2015

14 views

Category:

Documents


0 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

Getting Set-up to Develop

Java 2

Version 1.3

Page 2: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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

Page 3: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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

Page 4: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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

Page 5: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

Java Software Development KitJDK

From http://java.sun.com/

Page 6: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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

Page 7: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

Get and Install TextPad

• Go Tohttp://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

Page 8: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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"

Page 9: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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

Page 10: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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.

Page 11: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 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

Page 12: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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.

Page 13: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

Check Out the Code Examples

• With TextPad open the file– C:\tij\C02\HelloDate.java

This is the same stuff you typed into C:\tij\my\C02\HelloDate.javaIf later you have problems with your working copy of HelloDate.java you 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.

Page 14: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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

Page 15: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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

Page 16: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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.

Page 17: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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.

Page 18: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

Get Sun Documentation

• Go tohttp://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 in C:\jdk1.3\docs. In the

internal paths in the zip file will add the \jdk1.3\docs

Page 19: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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

Page 20: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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.

Page 21: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

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.

Page 22: Getting Set-up to Develop

© 2001 by Ashby M. Woolf Revision 2

End of Content