Download presentation
Presentation is loading. Please wait.
1
Java: History and Introduction (Lecture # 1)
2
History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green Project (According to Gosling, "the goal was... to build a system that would let us do a large, distributed, heterogeneous network of consumer electronic devices all talking to each other." ) – James Gosling Modified C++ – Named Oak then Java
3
History… Platform independent ("Write Once, Run Anywhere") Interpreted Language Intermediate Code (Byte Code) Reliable Multiple inheritance and Operator overloading removed No Pointers because of security reasons
4
History… – Internet exploded in 1993, saved project Reliability Security Platform Independence – Java formally announced in 1995 – Now used to create web pages with interactive content and applications for consumer devices (pagers, cell phones)...
5
Why Java??
6
Motivation Motivation Simple Pure Object Oriented Language Allows Multi-threading Automatic Garbage Collection More Robust (Run time exceptions) (Anyone heard of smart cards?)
7
Disadvantages Speed…Slower than C++ To the rescue: – Just-in-time (JIT) compilation Inability to access platform-specific code To the rescue: – Java Native Interface (JNI) (can also speed up code)
8
Difference Between C++ and Java Java is C++ minus – Pointers – Destructors – Structs and unions – Templates – Multiple Inheritance – Operator Overloading
9
Types Of Java Programs Applications: Stand-alone java programs runnable from command prompt Applets: Run from inside a web browser or the appletviewer
10
Basics of a Typical Java Environment Java Systems – Consist of environment, language, Java Applications Programming Interface (API) – Java programs have five phases 1. Edit.java extension 2. Compile javac command: javac MyProgram.java Creates.class file containing bytecodes
11
Basics of a Typical Java Environment 3. Loading Class loader transfers.class file into memory Classes loaded and executed by interpreter with java command To load, appletviewer Welcome.html Or java MyFile
12
Basics of a Typical Java Environment 4. Verify Bytecode verifier makes sure bytecodes are valid and do not violate security 5. Execute Computer interprets program one bytecode at a time Performs actions specified in program
13
Program is created in the editor and stored on disk. Compiler creates bytecodes and stores them on disk. Class loader puts bytecodes in memory. Bytecode verifier confirms that all bytecodes are valid and do not violate Java’s security restrictions. Interpreter reads bytecodes and translates them into machine language for that computer. Phase 1 Phase 2 Phase 3 Phase 4 Phase 5 Disk Editor Compiler Class Loader Disk Primary Memory............ Primary Memory............ Primary Memory............ Bytecode Verifier Interpreter
14
Java Virtual Machine (JVM) Hypothetical computer that executes a Java program = the interpreter Each computer architecture (Intel x86, Macintosh, etc.) has its own JVM implemented in software Sun Microsystems also has a JVM processor (hardware chip) Web browsers have built-in interpreter
15
Intro to Some Java Technologies Servlets: Small server-side programs JDBC: Links Java programs to databases RMI: Helps build distributed applications EJBs: Reusable software components
16
Thank you!!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.