0% found this document useful (0 votes)
13 views31 pages

001 - Introduction To Java

This document provides an overview of the Java programming language. It discusses that Java was originally developed by Sun Microsystems and was designed to be written once and run on any platform. The key aspects of Java that are covered include it being platform independent, simple, object-oriented, secure, portable, multithreaded and dynamic. The document also explains the Java development kit (JDK), Java runtime environment (JRE) and Java virtual machine (JVM). It provides instructions on downloading, installing and setting up the JDK and describes a simple "Hello World" Java program as an example.

Uploaded by

shakir.hello
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
13 views31 pages

001 - Introduction To Java

This document provides an overview of the Java programming language. It discusses that Java was originally developed by Sun Microsystems and was designed to be written once and run on any platform. The key aspects of Java that are covered include it being platform independent, simple, object-oriented, secure, portable, multithreaded and dynamic. The document also explains the Java development kit (JDK), Java runtime environment (JRE) and Java virtual machine (JVM). It provides instructions on downloading, installing and setting up the JDK and describes a simple "Hello World" Java program as an example.

Uploaded by

shakir.hello
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 31

Prepared by Shakir Hussain

€ What is Java?
€ Why Java?
€ Download, Install and Setup
€ Java Terminology- JDK, JRE, JVM
€ First Java Program
€ Java Environment – Java Compiler, Class
Loader, Bytecode Verifier, Java Virtual
Machine
€ Points to remember
€ High level programming language

€ Originally developed by Sun Microsystems, Which


was initiated by James Gosling

€ Designed with a concept of write once and run


anywhere

€ First version of java released in 1995

€ Initial name was Oak, later renamed to Green


and finally Java
James Gosling
€ Platform Independent
ƒ Write once run anywhere

€ Simple
ƒ Small language and large libraries

€ Object Oriented
ƒ Supports Abstraction, Encapsulation, Inheritance, Polymorphism etc.

€ Auto Garbage Collection


ƒ Memory management handled by Java Virtual machine

€ Secure
ƒ No memory pointers, program run inside virtual machine
ƒ Java Bytecode verification
ƒ Array Index limit checking
ƒ Signed Applets
€ Portable
ƒ Primitive data type size and their arithmetic behavior are specified by
the language.
ƒ Libraries define portable interfaces

€ Multithreaded
ƒ Easy to create and use

€ Distributed
ƒ Libraries for network programming
ƒ Remote method invocation

€ Dynamic
ƒ Finding runtime type information is easy.
ƒ The linking of data and methods to where they are located, is done at
run-time.
ƒ New classes can be loaded while a program is running. Linking is done
on the fly.
€ Whatdo you need to write and run java
program?
ƒ Java Development Kit (JDK)
ƒ A Text Editor
€ Download latest version of JDK (java
development kit) from
http://www.oracle.com/technetwork/java/javase
/downloads/index.html
and install.

€ Use the following link for Installation instructions


(for JDK 1.7)
http://docs.oracle.com/javase/7/docs/webnotes/
install/index.html

I am going to demonstrate simple download, install


and setup of JDK 1.7 on my windows X86.
€ Step 1 : Visit java download page, click on
jdk
€ Step 2 : Accept the license
€ Step3 : Download the JDK for your OS (I am
downloading JDK for Windows x86) and save
on your hard drive.
€ Click jdk-7u17-windows-i586.exe to install
€ Verify JDK and JRE on your hard disc.

€ Now,Set the path environment variable as


explained in next slide.
€ C:\Program Files (x86)\Java\jdk1.7.0_17\bin
€ JDK : Java Development Kit
ƒ All you need to develop, compile, debug and run
your java program.
€ JRE : Java Runtime Environment
ƒ Subset of JDK
ƒ Includes Minimum Elements required to run java
class file
ƒ Does not contain development tools like
compiler, debugger etc.
€ JVM : Java Virtual Machine
ƒ Actually runs the java program and uses the
library and other supporting files provided by JRE
€ What do you need?
ƒ Java Development Kit (JDK)
ƒ A Text Editor

€ Open the notepad, write the following code


and save the file as Hello.java (Let’s say file is
saved as E:/test/Hello.java)
€ Now, open command prompt, change directory to the
folder where you have saved your file.
€ Compile (javac Hello.java)
€ Run (java Hello)
€ Compilation
ƒ Java Compiler translates the java source file into
the class file
ƒ Class file contains bytecodes, the “machine
language” of the java Virtual machine (JVM).
ƒ This java class file can run on any hardware
platform and Operating System, which hosts JVM.
€ Class Loader
ƒ Class Loader loads class files into memory.
ƒ Class file can be loaded from local disc, network
or over the internet
€ Bytecode Verifier
ƒ It verifies that the bytecodes are valid and safe.
ƒ Does not violate java security restrictions
ƒ Checks the internal consistency of the class and
validity of the code
€ Java Virtual Machine
ƒ Translates the byte code into machine code
depending upon the underling operating system
and hardware combination. Which later executed
by processor.
Class
Loader Java
Class
Bytecode Libraries
Java Verifier
Source
(.java)
Just in
Java
Java Time
Execution
Bytecodes Engine
Code Java
move locally Generator Virtual
or through machine
Java network
Compiler

Java Operating System


Bytecode
(.class )
Hardware

30
€ Java Compiler, JVM .. All are platform
dependent.
€ Only java class file (Bytecode) is platform
independent.

You might also like