Docsity

Java Programming: A Beginner's Guide - History, Tools, and Getting Started, Slides of Computer Science

Partial preview of the text

Download Java Programming: A Beginner's Guide - History, Tools, and Getting Started and more Slides Computer Science in PDF only on Docsity!

Contents (chapter 1)

  • Short History
  • Java Development tools
  • Install JBuilder Tool and Samples
  • Getting Started With Java Programming
    • Compiling and Running a Java Application
    • Compiling and Running a Java Applet

History

  • James Gosling
  • Oak (Embedded consumer electronic

appliances)

  • Java, May 20, 1995, Sun World
  • HotJava
    • The first Java-enabled Web browser

Java Development Tools

  • Sun JDK
  • Inprise JBuilder (RAD)
  • Microsoft Visual J++
  • Symantec Café (RAD)
  • Rouge Wave JFactory
  • Sun Java Workshop
  • IBM Visual Age for Java (RAD)

Install JBuilder and Samples

• Install JBuilder

• Install Sample Programs

• Setup JDK 1.2.2 environment

  • Set classpath=%classpath%;c:\jbbook
  • Set path=%path%;c:\jdk1.2.2\bin
  • Check Java Home:
  • www.javasoft.com

A Simple Application

Example 1.

//This application program prints Welcome

//to Java! public class Welcome { public static void main (String[] args) { System.out.println("Welcome to Java!"); } }

Source Run

Compiling Programs

  • On command line
    • javac file.java Java Source File

Bytecode

Compiler

Example

javac Welcome.java

java Welcome

output:...

A Simple Applet

Example 1.

/* This is an example of Java applets */

import java.awt.Graphics;

public class WelcomeApplet

extends java.applet.Applet { public void paint (Graphics g) { g.drawString("Welcome to Java!",10,10); }

} Source

Viewing Java Applets

Browser with Java Interpretation on Windows

Browser with Java Interpretation on Sun

Applet

Applet Viewer Utility

appletviewer htmlfile.html

Example:

appletviewer WelcomeApplet.html

Run Applet Viewer

Security Restrictions on Applets

  • Applets are not allowed to read from, or write to, the file system of the computer viewing the applets.
  • Applets are not allowed to run any programs on the browser’s computer.
  • Applets are not allowed to establish connections between the user’s computer and another computer except with the server where the applets are stored.