Java programming lecture 1
This presentation is the property of its rightful owner.
Sponsored Links
1 / 17

Java Programming Lecture 1 PowerPoint PPT Presentation


  • 36 Views
  • Uploaded on
  • Presentation posted in: General

Java Programming Lecture 1. Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung U niversity email: [email protected] u .edu.tw http:/ / www.cse.ttu.edu.tw/~cheng. Contents (chapter 1). Short History Java Development tools

Download Presentation

Java Programming Lecture 1

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Java programming lecture 1

Java Programming Lecture 1

Instructors:

Fu-Chiung Cheng

(鄭福炯)

Associate Professor

Computer Science & Engineering

Tatung University

email: [email protected]

http:// www.cse.ttu.edu.tw/~cheng


Contents chapter 1

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

History

  • James Gosling

  • Oak (Embedded consumer electronic appliances)

  • Java, May 20, 1995, Sun World

  • HotJava

    • The first Java-enabled Web browser


Jdk versions

JDK Versions

  • JDK 1.02 (1995)

  • JDK 1.1 (1996)

  • Java 2 SDK v 1.2 (a.k.a JDK 1.2, 1998)

  • Java 2 SDK v1.3 (a.k.a JDK 1.2, 2000)

  • Java 2 SDK v1.4 (Dec. 2001)

  • Java 2 SDK v1.5 (June 2003 ??)


Java development tools

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 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


Getting started with java programming

Getting Started with Java Programming

  • A Simple Java Application

  • Compiling Programs

  • Executing Applications

  • A Simple Java Applet

  • Viewing Java Applets

  • Applications vs. Applets


A simple application

A Simple Application

Example 1.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

Compiling Programs

  • On command line

    • javac file.java


Executing applications

Executing Applications

  • On command line

    • java classname


Example

Example

javac Welcome.java

java Welcome

output:...


A simple applet

A Simple Applet

Example 1.2

/* 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


Creating an html file

Creating an HTML File

<html>

<body>

<applet code="WelcomeApplet.class"

width = 100 height = 40>

</applet>

</body>

</html>


Java programming lecture 1

Viewing Java Applets


Applet viewer utility

Applet Viewer Utility

appletviewer htmlfile.html

Example:

appletviewer WelcomeApplet.html

Run Applet Viewer


Applications vs applets

Applications vs. Applets

  • Similarities

  • Differences


Security restrictions on applets

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.


  • Login