Вы находитесь на странице: 1из 34

Java

27 2003
:
( Sun ) <vyazovick@itc.mipt.ru>
( Sun ) < gene@itc.mipt.ru>
Copyright 2003 Sun , , .

Rendered by www.RenderX.com

ii

,
Java
,
Sun Microsystems () .
Java
. Sun Microsystems ,
Java , .

Java , Sun
.
Java
Sun Microsystems
.

Java

Rendered by www.RenderX.com

iii

1. Java? .................................................................. 1
1. Java? .............................................................................................................. 1
2. Java ................................................................................................. 2
2.1. Sun Microsystems .................................................................. 2
2.2. Green .........................................................................................................4
2.3. FirstPerson.............................................................................................6
2.4. World Wide Web..................................................................................................... 7
2.5. Oak ................................................................................................. 9
2.6. Java .............................................................................................10
3. Java .................................................................................................11
3.1. ............................................................................................................. 11
3.2. ......................................................................................... 14
3.3. Java ................................................................................................. 17
4. .................................................................................................................. 26
5. ...................................................................................................26

Java

Rendered by www.RenderX.com

iv

Java

Rendered by www.RenderX.com

. 1 30

1. Java?
.
.
1. Java? ..............................................................................................................1
2. Java .................................................................................................2
2.1. Sun Microsystems ........................................................................ 2
2.2. Green .............................................................................................................. 4
2.3. FirstPerson.................................................................................................. 6
2.4. World Wide Web........................................................................................................... 7
2.5. Oak ....................................................................................................... 9
2.6. Java .................................................................................................. 10

3. Java ................................................................................................ 11
3.1. ................................................................................................................... 11
3.2. ...............................................................................................14
3.3. Java ....................................................................................................... 17

4. ................................................................................................................. 26
5. .................................................................................................. 26

1. Java?
Java ?
, ?
Java - ,
,
- (-). Java -
( , ..).
, ++
garbage collector' - "" ( ,
). , Java
, - ,
, HTML-.
, ,
, - ,
Java

Rendered by www.RenderX.com

. 2 30

Java

- Java . ,
, ,
, .
. -,
Java -
" ". -, JavaOne,
1996 , 10.000
(
5.000). Sun,
Java , Java Developer Connection
1996 , 100.000 , 2000
- 1.5 . Java
3 .
5 , 1.0 1995 1.4
2002 . 1.5 2003 .

- Java http://java.sun.com/. Java - JDK 1.1 (
Java)
220.000 . 1.4 2 5
.
Java ,
. " " IBM, Macintosh
Apple, Oracle,
Sun - Microsoft - Java 1996 .
,
Java, , ,
, ,
.

2. Java
Java, ,
Oak (), 1990
Sun. ,
.

2.1. Sun Microsystems


, 1990 ,
WWW (World Wide Web - " ") .
.
, Sun Microsystems,
,
"" -
Sun " ,
"" " [3].
Java

Rendered by www.RenderX.com

Sun Microsystems

. 3 30

(Scott McNealy), , CEO


( ) Sun, , 25-
(Patrick Naughton),
3 , NeXT. ,
- " ".
, . ,
, , Sun . ,
, ,
.
, .
NeWS,
,
NeXTstep. :
-,
Sun ;
, (
, ,
); , Window Systems
Group ( , ).
, , ,
NeXT - .
.
,
. , , ,
, , .
(Bill Joy) (James Gosling). -
- Sun,
UNIX . Sun 1984 (
IBM) ,
EMACS C.
.
, - ,
. , 4.30
, . : , ;
- ;
,
, - .
, (John Gage),
Sun, .
,
: Sun,
; ,
Sun;
Sun;
.
Java

Rendered by www.RenderX.com

. 4 30

Java

2.2. Green
5 1990 , , NeXT, Sun
.
. - " - ". 1 1991
, (Mike Sheridan)
, Green.
- ,
(
), .
,
, .
Sun 1991 , ,
,
, , , !
,
- , .
,
, ,
.
, ,
-.
1991 Sun
.
, Nintendo, ,
, ,
, .
,
, ,
42 . , ,
, ,
- 50- .
,
. ,
,
, , .
,
, ,
, , , ,
, ,
.
++,
, .
, . ++ -
, .
,
. 1991 ,
Java

Rendered by www.RenderX.com

Green

. 5 30

14 , C++.
, , ,
. - Oak ().
, Java.
, ,
, .
,
.
, ,
, ,
, ( !) .
,
" ". - ,
,
. ,
.
Sun.
- *7, Star7 (
,
,
).
(Duke),
. Java,
, , , .
, , ,
. , .
1991 .
Sun . ,
.
, , - "1st Person" (
" ").
, 4 1992 Star7 .
5" (16 ) .
, .
- !
, "" , ,
- .
, ""
, .
! ,
(PDA), Newton, ,
. 286i 386i Intel (486i ,
) MS DOS,
.
Sun ,
, HP, IBM Microsoft.
Java

Rendered by www.RenderX.com

. 6 30

Java

. - Oak
,
. , ,
,
.
Oak, , , , ,
. , ,
, ,
. , ,
, Oak , ,
, , ,
.

2.3. FirstPerson
-, Mitsubishi Electric, France Telecom, Dolby Labs,
, .
- "Beyond the Green Door" (" "),
Sun
Oak . 1 1992 FirstPerson,
(Wayne Rosing), Sun Labs. ,
14 60 .
, (, ,
) $50.
,
.

, ,
. , 1993 Time Warner

, FirstPerson .
- (James Clark), Silicon
Graphics Inc., ,
Oak. , Time Warner SGI ,
Netscape, Java.
3DO.
10 , Oak ,
, 3DO ,
.
, 1994 ,
. , .
FirstPerson , ,
. Sun
-, .

Java

Rendered by www.RenderX.com

World Wide Web

. 7 30

2.4. World Wide Web



. 1993
(Marc Andreessen) (Eric Bina),
(National Center for Supercomputing Applications, NCSA)
,
("") Mosaic 1.0 WWW. Internet
20 , (FTP, telnet .)
,
. Mosaic
(HyperText Markup Language, HTML), 1991
(CERN) .
, -
,
, ,
. ,

, HTML
- (World Wide Web, WWW).
-
.

, .
WWW ,
. , ,
,
- , ,
.
, Sun .
Sun Mosaic ! ,
50%
Sun.
- FirstPerson ,
.
,
, .
Oak, ,
CD-ROM , ,
. ,
, Oak
. Mosaic
.
Sun (
-
Sun). - FirstPerson
Sun Interactive,
Java

Rendered by www.RenderX.com

. 8 30

Java

- Oak.
, ,
Java.
FirstPerson , ,
, Oak,
WWW. ,
UNIX ,
, .
WWW,
Netscape ,
.
Sun,
Oak (,
"Liveoak"). -
Oak .
, "" ,
Oak .
, .
.
, Cobol. Fortran IBM,
. Basic -
Microsoft - -
. ++
, Mac OS Windows. Oak ,
.
, 1994 WWW (,
), -
, .
- ,
HTML-, .
- CGI (Common Gateway
Interface).
.
(, ,
), ,
, .
GIF- .

,
, .
, - ,
(enterprise) ,
. - ,
, ,
,
.
( " ", ,
Java

Rendered by www.RenderX.com

Oak

. 9 30

, , ).
, ,
. , ,
.
.
-
. -,
- ,

. -, .
, .

, - . ,
, , ,
CD-ROM'. ,
.
Oak, ,
, , WWW .
, ,
Green.

2.5. Oak
Oak - ,
. ""
,
.
WebRunner. ,
. , 1994 WebRunner
Sun. , Oak
, (applets),
.
,
- .
WebRunner, , ,
Mosaic.
.
, ! , ,
, ,
.
. .
, .
, ,
.
Java Development Kit . ,
Java

Rendered by www.RenderX.com

. 10 30

Java

, , Oak WebRunner
,
, .
, 1995 , ,
, . Oak
Java, WebRunner HotJava.
, . , Java -
( ), . ,
HotJava ( Java).
( Java Beans , Java JAR ..) , " ".
, , ,
( , ,
, - Neon, Lyric, Pepper Silk).
Java, HotJava
. ,
-
-. ,
, ,
. 1994
Sun. 1995 ,
, -, , - Oak WebRunner
.
, , -
. . ,
10.000, " ".
10.000 , .
, ,
- .
, , .
, .
, , 2-3
.
Sun , Java
.
23 1995 Sun Jose Mercury News
,
http://java.sun.com/,
Java.

2.6. Java
, .
Java,
, SunWorld. ,

Java

Rendered by www.RenderX.com

. 11 30

,
- UNIX-. , .
4 , , Sun
. - Netscape, 1994
( Oak ,
Time Warner) ( NCSA Mosaic).
, 1994
Netscape Navigator,
, 75% .
23 1995 Java HotJava Sun [14],
, Netscape Navigator
2.0 [15]. , , Java
WWW, HTML.
.
Java .

3. Java
, Java ,
, Sun
.

3.1.
, .
,
. ,
. ,
.
Java - ,
- -
, (
GIF, - Macromedia Flash);
; , , ,
.
Java - , HTML.
,
. Java Development Kit (
Java) ,
. , .
, , , .
, , ,
.
" " HTML
. ,
Java

Rendered by www.RenderX.com

. 12 30

Java

, . ,
, ,
. ,
, , ,
.
, ,
- -
. - "" .
,
, , ,
.
Java, , HotJava,
. Netscape Navigator,
2.0, Java. , ,
- Microsoft Internet Explorer.
Microsoft,
, ( )
Sun, IBM, Netscape .
Microsoft Windows
(MS Office), ,
Internet. 1995
"" Netscape WWW,
. Netscape
Sun, Microsoft .
Internet Explorer 2.0 , ,
- Netscape Navigator. ,
IE 3.0 , NN 2.0. 7
1995 Microsoft Java, 1996
.
, ,
.
.
, Microsoft .
Netscape Navigator 3.x , Netscape 4.x
Internet Explorer 4.x. NN 5.x , NN 6.x
"". 7.0,
, Internet Explorer 5.0, 5.5 6.0
95% .
, Microsoft , Netscape
. . ,
Microsoft , W3C,
HTML 3. Netscape
, HTML,
- .
Microsoft, , ,
, Netscape Navigator,
Java

Rendered by www.RenderX.com

. 13 30

. , ,
W3C , Navigator .
, NN ( )
, IE Windows,
( , , ).
Netscape ?
(, )
NCSA Mosaic. HTML ,
, Navigator',
.
Mosaic,
Netscape.
Netscape Navigator .
, ,
Microsoft, , ,
" ", HTML
, .
HotJava, , . Sun
- HTML.
, HotJava
. 3.0.
, , - Java Script,
Java, ,
. , .
4 1995 Netscape Sun " "
(scripting language) Java Script. - , .
Java Script HTML (
.js). ,
. , Java
Script HTML, - Java.
Java -,
.
Java Script Java:
. Java Script Visual Basic -
, .
-. Java Script . ,

, . ,
, HTML - .
.
.
, Java Script
-.
Java

Rendered by www.RenderX.com

. 14 30

Java

Java Script Java . ,


.
Java Script - (
), ,
.
. Sun
Netscape . Netscape Navigator 2.0 . ,
Java Script , Java,
, " Java". ,
Netscape.
, Java Java Script -
, - . Java
- (),
, Java - .
Java Script, ,
HTML. , ,
, 3D
( , ),
.
, Java Script, ,
, . ,
-
,
.

3.2.
, ,
Java. Java
NeWS ( ,
, X Window), Sun
,
, . 9 1996
JavaSoft, Java-
. -
, . , 1 1997
, NASA (National Aeronautics and Space Administration,
, ) Java-
, ("Java !").
, Java
- "", Java ?
, , -,
(""), (Intel x86, Sun SPARC,
PowerPC .), , -, (MS Windows, Sun Solaris, Linux,
Mac OS .).
Java

Rendered by www.RenderX.com

. 15 30

, ,
(GUI) . ,
,
(API, Application Programming Interface),
, .
,
. .
,
- (,
Mac OS ,
Windows ).
.
( ), , ,
, , .
, ,
,

.
,
, .
,

. Java
, ,
Oak ,
.
"" ?
, - . Java
, , Java Virtual Machine.
JVM - , ,
, -
Java-. Sun JVM
.
Java, , .
JVM , , Sun
, ,
. 29 1996 Java OS (
). - - ",
, Java". ,
Java-
- , (PDA), ,
, . , Java OS
.
Java -
, .
Java

Rendered by www.RenderX.com

. 16 30

Java

, Java -
. -
, , Java
.
Java- " 100%".
, Sun
-
.
Sun, " - ".
,
, - . , , ,
WWW , .
,
- . , ,
,
.
, -
, . ,
, , , - !
,
,
- Microsoft. (
) Windows
Intel ( - Wintel).
, -
, ,
Wintel.
Microsoft
(, Netscape Navigator
MS Internet Explorer),
. ,
Wintel .
,
, ,
.
, Microsoft Java, , ,
, Internet
Explorer .
. 30 1997 IE 4.0, 7 Sun ,
.
18 Sun , "
Java" ("Java compatible") MS IE 4.0. , Microsoft ""
Java, .
, ,
. , Sun
. Java ,
Java

Rendered by www.RenderX.com

Java

. 17 30

"Write once, run everywhere" (" , ").


, "
".
Sun . 24 1998
(, ,
23 2001 , Sun 20
), 12 Sun
Microsoft Java Windows
98 .
. , Microsoft Internet Explorer'
java.rmi, ,
DCOM - , Win32.
(patch),
. Microsoft Java
1.1,
.
, (
),
. Sun Java Plugin, MS IE NN, Java
,
( Java Activator 10
1997 ). Microsoft , Java
Windows XP, ,
.
Java OS, ,
. , JVM
,
. Java, ,
.

3.3. Java
, Java ,
, ,
.
, ,
- -. ,
JVM, ,

Java-. JVM ,
-
.
Java,
- Java
? , .

Java

Rendered by www.RenderX.com

. 18 30

Java

Java
,
.java.
Java-, Java -.
JVM
Java.
.class.
Java-, , ,
, , .
Sun "Write once,
run everywhere",
. ,
. Java ,
. ,
, .
Sun ,
( Java) .
.
JVM 600 ,
, (
MS IE 4.0). , ,
, . - ,
,
. Java 2 Micro Edition (J2ME),
.
Java,
-.
, , Java
- (threads) (steams), ,
, , ..
, Java - ,
.
Java ,
. -,
. ,
. - "".
.
, Java . ,
, .
,
. (exceptions -
Java ) (runtime)
, , ,
. ,
, (
, ).
Java

Rendered by www.RenderX.com

Java

. 19 30

Java 8 , .
. 5 : byte, short, int,
long, char. 2 float double,
boolean. (
primitive), , .
- (. reference).
Java - .
C/C++, ,
Java, , .
- "Java - C++
, garbage collector".
(garbage collector) , Java ,
C++, - .
, , Java
. -,
C++ . -,
- , ? , ,

, Java
. ,
.
, , ++ ,
Sun, , Java
, .
.
, ,
Smalltalk IBM 60-
Simula, Java .
Java - -
. ,
,
C/C++. .
Java (
garbage collector). , , ,
, .
, .
/++ . ,
- , - (
, ),
, , ,
.
Java .
,
, garbage collector.
, ,
. - ,
Java

Rendered by www.RenderX.com

. 20 30

Java

, .
garbage collector,
. ,
, .
,
, . ,
, , (
) .. ,
, , ,
/++, ,

.
, . ,
( ,
!), Java ,
,
( ,
..). .
, , .
,
.
.
, - 90- ,
. ,
, ,
, .
garbage collector,
. - ,
.
Java ( ,
, ,
). .
, Java, C/C++,
. , -
, .
Java - .
,
, .
Java .
.
-, . ,
. JVM,
, ,
.
.

Java

Rendered by www.RenderX.com

Java

. 21 30

-, -
. - ,
, class-. JVM ,
Java,
- ( ).
, .
, ,
(
). ,
.
Java.
, ,
. ,
, . , ,
,
, ,
. ,
.
Java ,
- -( ) .
, Java - .
,
. .
, . Java- :
, -;
, ;
/++;
;
-, ;
, ;
.
, ,
. ,
, Java
. .
,
Sun, " " (reference implementation).
, Java 23 1995 . ,
-, :
Java language specification, JLS, Java ( ,
, , ..);

Java

Rendered by www.RenderX.com

. 22 30

Java

JVM;
Java Development Kit, JDK - , ,
.
,
. , ,
, (,
), .
.
JVM ,
Java-.
JDK .
, java-.
javac (java compiler) .
java. appletviewer.
,
javadoc.
8 :
java.lang - , ( language);
java.util - ;
java.applet - ;
java.awt, java.awt.peer -
(GUI), Abstract Window Toolkit, AWT.
.
java.awt.image - ;
java.io - (streams) ;
java.net - .
, java, .
( com, org .)
.
JDK 1.0 1996 .
. .
1. ,
1... , , JDK,
.
- JDK,
,
.
0 4 ( ).
(212, 504, 1781, 2130

Java

Rendered by www.RenderX.com

Java

. 23 30

2738 - 1.0 1.4),


. , JDK.
, .
, , ,
() . , JDK 1.0 - 1.0.2.
1. , , -
. deprecated,
2.0 ( ), .
JDK 1.0 . ,
, . -, , .
. , JVM
, ,
. , , , .
AWT,
.
1996 JDK 1.1,
-. 1997 .
Java?
, . -,
Assembler,
C, . , 1996 Sun - JustIn-Time , JIT. - Java - ""
. , ,
50 ! 1997
Windows, JIT JDK
.
. JavaBeans - ,
1996 , ,
. JDBC (Java DataBase Connectivity)
. RMI (Remote Method Invocation)
. .
3 JDK 1.1 220.000 , -
2- . 1.1 ,
1.1.8. - ,
MS IE ,
.
, 11 1997 Sun Java Runtime Environment, JRE ( Java).
, Java-,
. , ,
.
,
(GUI). 1996 Sun Netscape
IFC (Internet Foundation Classes), Netscape
Java .
Java

Rendered by www.RenderX.com

. 24 30

Java

1997 , AWT Sun


IFC Netscape Java Foundation Classes, JFC,
:
, Swing;
Drag-and-Drop.
2D , ;
Accessibility API ;
. IBM . 1997
JFC. , ,
com.sun.java.swing Swing. 1998
. 500.000 .
Java 1.2 ,
1.1,
Java 2 ( , ,
1.., ). -
1997 , 8 1998 ,
.
,
:
, (policy)
(permission);
JFC JDK, , ,
javax.swing Swing ( javax ,
Java);
(collection framework) -
;
Java Plug-in JDK;
, (
), "-2000".
1999 JVM
.
JDK 1.2. 15
1999 JavaOne Sun
Java 2 :
Java 2 Platform, Standard Edition (J2SE);
Java 2 Platform, Enterprise Edition (J2EE);
Java 2 Platform, Micro Edition (J2ME).
, ,
,
. ,
Java.
Java

Rendered by www.RenderX.com

Java

. 25 30

J2SE
. , Standard Edition - Java
JDK ( j2sdk).
J2EE , ,
. , Enterprise Edition -
(, Enterprise Java Beans, EJB) (
, Application Server), .
j2sdk.
J2ME Standard Edition ,
,
.
. J2SE
, J2EE 1999 .
j2sdk 1.2 - 1.2.2.
, Sun
. 1999 (engine) Java HotSpot.
,
(garbage collector) .
,
Java-.
- .
.
.
HotSpot , 2000
JVM J2SE.
,
j2sdk 1.3 (
1.3.1).
, J2SE 1.4 2002 .
- (web services).
XML (Extensible Markup Language).
- assert,
,
. , .
j2sdk 1.4 . 2002
1.4.1,
.
Standard Edition
, ,
1.3: 1.4:

Java

Rendered by www.RenderX.com

. 26 30

4.
, Sun
1990 .

.
Green. , ,
Oak. Sun FirstPerson,
, , Java,
. 1993
Mosaic 1.0
. Java- ,
HotJava. , 4-
, Java .
Netscape, .
Java
. Java Script, ,
, Java.
Java. Sun: JDK JRE.
Java,
.

5.
1-1.

Java. JVM?
a.) :

Java,
/++

(garbage collection)

Java-

Java

Rendered by www.RenderX.com

. 27 30

( SSL .)

JVM Java Virtual Machine, Java,


-, class-.
-,
,
.
1-2.

Java ?
a.) . , .

1-3.

(garbage collector)?
a.)
Java. ,
, .

1-4.

Java C/C++?
a.) .
Java -,
, .

1-5.

Java , ?
a.) ,
,
, , .Java
,

.

1-6.

- Sun Microsoft
MS Internet Explorer 4.0?
a.) Java -,
.
,
.
Microsoft Internet Explorer 4.0
,
,
Java.

1-7.

, Java?

Java

Rendered by www.RenderX.com

. 28 30

a.) Java ,
java.
.class-, -,
. -
(.jar .zip).
1-8.

Java-,
Sun ?
a.) Java
. ,
.
Java ,
.
Sun, JVM, JIT
(Just-in-time),
,
. 1.3 HotSpot,

.

1-9.

?
a.) , Java, ,
,
. HTML-.

,
, .

1-10. Java?
a.) 23 1995 SunWorld.
1-11. Java?
a.) Java http://java.sun.com
1-12. Java? Java2?
Java?
a.) .
.
, , ,
,
.
,
, ,
.
0 4 ( 1.0 1.4).
.
Java 1.2 1.1, ,
Java

Rendered by www.RenderX.com

. 29 30

, Java2 (
).
.
, ,
.
Java 1.4.0.
1-13. deprecated?
a.) Java
,
, ,
. deprecated,
,
.
1-14. Java Java2?
a.) 1999 Java
:

J2SE Java2 Standard Edition, Java,


JDK

J2EE Java2 Enterprise Edition, ,


,

J2ME Java2 Micro Edition, J2SE


1-15. Java ? Java Plugin?


a.) Java 1.1,
,
..
,
.
Sun 1997
Java Plug-in,

Java. Plug-in .
1-16. JDK JRE? ?
?
a.) JDK Java Development Kit, Java,
,
. :

java JVM

javac Java

appletviewer
Java

Rendered by www.RenderX.com

. 30 30

jar JAR

javadoc

JRE Java Runtime Environment, Java,


Java-,

.

Java

Rendered by www.RenderX.com

Оценить