Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Programming Lecture 1 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University

Similar presentations


Presentation on theme: "Java Programming Lecture 1 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University"— Presentation transcript:

1 Java Programming Lecture 1 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University email: cheng@cse.ttu.edu.tw http:// www.cse.ttu.edu.tw/~cheng

2 Contents (chapter 1) Short History Short History Java Development tools Java Development tools Install JBuilder Tool and Samples Install JBuilder Tool and Samples Getting Started With Java Programming Getting Started With Java Programming  Compiling and Running a Java Application  Compiling and Running a Java Applet

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

4 JDK Versions JDK 1.02 (1995) JDK 1.02 (1995) JDK 1.1 (1996) JDK 1.1 (1996) Java 2 SDK v 1.2 (a.k.a JDK 1.2, 1998) 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.3 (a.k.a JDK 1.2, 2000) Java 2 SDK v1.4 (Dec. 2001) Java 2 SDK v1.4 (Dec. 2001) Java 2 SDK v1.5 (June 2003 ??) Java 2 SDK v1.5 (June 2003 ??)

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

6 Install JBuilder and Samples Install JBuilder Install JBuilder Install Sample Programs Install Sample Programs Setup JDK 1.2.2 environment Setup JDK 1.2.2 environment  Set classpath=%classpath%;c:\jbbook  Set path=%path%;c:\jdk1.2.2\bin Check Java Home: Check Java Home:  www.javasoft.com

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

8 A Simple Application Example 1.1 //This application program prints Welcome //to Java! public class Welcome { public static void main (String[] args) public static void main (String[] args) { System.out.println("Welcome to Java!"); System.out.println("Welcome to Java!"); }} RunSource

9 Compiling Programs On command line On command line  javac file.java

10 Executing Applications On command line On command line  java classname

11 Example javac Welcome.java java Welcome output:...

12 A Simple Applet Example 1.2 /* This is an example of Java applets */ import java.awt.Graphics; public class WelcomeApplet extends java.applet.Applet { extends java.applet.Applet { public void paint (Graphics g) { public void paint (Graphics g) { g.drawString("Welcome to Java!",10,10); g.drawString("Welcome to Java!",10,10); }} Source

13 Creating an HTML File <body> <applet code="WelcomeApplet.class" width = 100 height = 40> width = 100 height = 40></applet></body></html>

14 Viewing Java Applets

15 Applet Viewer Utility appletviewer htmlfile.html Example: appletviewer WelcomeApplet.html Run Applet Viewer

16 Applications vs. Applets Similarities Similarities Differences Differences

17 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 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 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. Applets are not allowed to establish connections between the user’s computer and another computer except with the server where the applets are stored.


Download ppt "Java Programming Lecture 1 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University"

Similar presentations


Ads by Google