Java Programming Lecture 1 - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Java Programming Lecture 1

Description:

Install JBuilder Tool and Samples. Getting Started With Java ... James Gosling. Oak (Embedded consumer electronic appliances) Java, May 20, 1995, Sun World ... – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 17
Provided by: yda1
Category:

less

Transcript and Presenter's Notes

Title: Java Programming Lecture 1


1
Java Programming Lecture 1
  • Instructors
  • Fu-Chiung Cheng
  • (???)
  • Associate Professor
  • Computer Science Engineering
  • Tatung University
  • email cheng_at_cse.ttu.edu.tw
  • http// www.cse.ttu.edu.tw/fccheng

2
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

3
History
  • James Gosling
  • Oak (Embedded consumer electronic appliances)
  • Java, May 20, 1995, Sun World
  • HotJava
  • The first Java-enabled Web browser

4
Java Development Tools
  • JDK1.0, JDK1.0.2, JDK1.1, JDK1.2
  • The New Java 2 Name
  • Inprise JBuilder (RAD)
  • Microsoft Visual J
  • Symantec Café (RAD)
  • Rouge Wave JFactory
  • Sun Java Workshop
  • IBM Visual Age for Java (RAD)

5
Install JBuilder and Samples
  • Install JBuilder 3 University
  • Install Sample Programs
  • Setup JDK 1.2.2 environment
  • Set classpathclasspathc\jbbook
  • Set pathpathc\jdk1.2.2\bin
  • Check Java Home
  • www.javasoft.com

6
Getting Started with Java Programming
  • A Simple Java Application
  • Compiling Programs
  • Executing Applications
  • A Simple Java Applet
  • Viewing Java Applets
  • Applications vs. Applets

7
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!")

Run
Source
8
Compiling Programs
  • On command line
  • javac file.java

9
Executing Applications
  • On command line
  • java classname

10
Example
  • javac Welcome.java
  • java Welcome
  • output...

11
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
12
Creating an HTML File
  • lthtmlgt
  • ltbodygt
  • ltapplet code"WelcomeApplet.class"
  • width 100 height 40gt
  • lt/appletgt
  • lt/bodygt
  • lt/htmlgt

13
Viewing Java Applets
14
Applet Viewer Utility
  • appletviewer htmlfile.html
  • Example
  • appletviewer WelcomeApplet.html

Run Applet Viewer
15
Applications vs. Applets
  • Similarities
  • Differences

16
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 browsers computer.
  • Applets are not allowed to establish connections
    between the users computer and another computer
    except with the server where the applets are
    stored.
Write a Comment
User Comments (0)
About PowerShow.com