Introduction to Java & Installing the SDK and BlueJ

Announce

•      Start Attendance Sheets

•      First quiz Friday

–   Over common html tags

–   Covers up to “Decision Trees” page 22 of your text.

–   The quiz will be the second part of the class.  When you finish the quiz, you may hand it in, then leave

•      You should be reading Chapter 2 of the text

 

Object Oriented Programming

•      Everything is treated as an object

•      An object has two parts

–   The attributes of the object (the data)

–   The manipulation of the attributes

•      First, a template for objects is declared

–   In Java the template is called a class

•      Then different instances of the template are created

 

The Java environment

•      A text editor is used to record the high level java program in ASCII code

•      A java compiler translates it into bytecode (J-code)

•      A bytecode interpreter translates it into the machine language for the specific machine it is running on

 

The Java Platform

•      First, you create the source code with a text editor

–    This file is saved with a .java extension

•      Next the source code is compiled into bytecode.

–    this file is saved with a .class extension

•      On the local machine an interpreter reads the bytecode and translates it into machine language for that specific machine.

–    It is easier to write an interpreter for the Java bytecodes than it is to write a compiler for the Java source code

•       This interpreter is included in modern browsers so that they can interpret bytecodes (i.e. run an applet)

 

Two ways of using Java

•     Applications and Applets

–  Applets

•   programs that can be embedded in HTML documents.

•   HTML has tags specifically designed for Java applets

–  Applications

•   Traditional programs that can run stand-alone from the command line or a GUI

•   In Java, a main method is included in a class to make it an application

 

Getting started with Java

•      The Java compiler, called the Java Development Kit (JDK) is provided free from Sun, who developed Java

–    Now called the SDK (Sun Development Kit)

•      The user interface to the SDK is fairly primitive

•      BlueJ is a system that uses the SDK; it provides a GUI, designed especially for education

•      There is a BlueJ tutorial (31 pages) provided by the developers of BlueJ, available for download free

–    It is in Adobe Acrobat format.

 

Installing  the SDK

•      First you must go to the Sun site and download the SDK.

–    You want the Standard Edition J2SE 1.4.0

–    It is 30 MB, so if you have a slow connection you may prefer to buy a disk with it on.

•    AWC is selling these disks for $3.00

•      The name of the file is
                
j2sdk1_4_0_01-windows-i586.exe

•      Notice that the extension is .exe

–    This mean it is executable.  When you double click on it, it will unzip itself an then install itself

•      You must notice the name of the directory where it installs itself  The default is C:\j2sdk1.4.0_01

 

Installing  BlueJ

•      BlueJ( www.bluej.org ) was developed at a University specifically for the purpose of teaching object orientation with Java

•      The file you need to install BlueJ is
                
bluejsetup-121.exe

•      If you click on this file it will also install itself.

–    It will ask you where the SDK is stored.  Be sure it is correct

–    Then it will ask you where you want BlueJ.  Anywhere is fine as long as you know where it is.

 

Learning to use the SDK and BlueJ

•      For your PreLab, you will need to work through the BlueJ tutorial.

•      This means you must have a copy of it before lab Tuesday!

•      You can either download it from here and print it yourself, or pay Card n Copy for a copy of it

•      There is also a reference manual you can view and print if you wish

•      If you get error messages installing BlueJ, you should try the FAQs or Tip of the Week Archive on the BlueJ site

 

The BlueJ tutorial & reference manual

•      Both are in Adobe Acrobat format

–   This is a common format that allows people distributing information to get it to you all ready to print or view

–   In order to view it, you must download the Adobe acrobat reader.  It is free from Adobe

•   It is also on the disk from AWC