SlideShare a Scribd company logo
3
Most read
7
Most read
12
Most read
Java Programming
Manish Kumar
(manish87it@gmail.com)
Lecture- 2
Contents
 Java Environment Set up
 Simple Java Program
 Internal details of Java Programs
 JDK, JRE & JVM
Environment Set up
 To set path of java is required when you save source file (i.e., .java file) any where in your system except bin
directories.
 To set environment for java programming you must follow the steps given below:
 Download JDK according to the version of Operating System.
 Run the .exe file and install it.
 You will need to set path to point to correct installation directories.
 To set permanent path for windows:
Suppose you have installed jdk in C:Program Filesjavajdk directories:
 Right Click on Computer and then select Properties
 Click on Advanced tab and then click on Environment Variable button
 Click on new button under user variable/system variable and write variable name as path & variable
value as: ‘C:Program Filesjavajdkbin'
Environment Set up
 To set temporary path for windows:
 Press Window + R button on keyboard and type cmd in run prompt and click ok button (i.e. open
command prompt)
 Copy the path of jdk/bin directories
 Type set path = copied path
For Example:
Set path = ‘C:Program Filesjavajdkbin’
 To set path for Linux:
To set the path of java in Linus is same as windows but in the case of Linux we use the export
tool rather than set. Path in Linux is look like as
export PATH = $PATH:/home/jdk1.6.01/bin/
Simple Java Program
To write a simple Java Program, we must know some basic points like class, object, etc. These are described
briefly as follows:
 Object is a real-world entity and it has state and behavior. An object can also be defined as instance of the
class.
 Class can be called as group of similar type of objects. Class is like a template that describe the
state/behavior of objects.
 Methods: We write logics, data is manipulated and all actions are executed in methods. There can be many
methods in a class.
 Instance Variable: Every object has its unique set of instance variable. Instance variable is declared out side
the methods i.e. at class level.
Simple Java Program
First Java Program:
public class FirstProgram {
public static void main (String args []) {
System.out.println(“First Java Program”)
}
}
Save this file as FirstProgram.java
To compile: javac FirstProgram.java
To Execute: java FirstProgram
Output First Java Program
Simple Java Program
Important Points of Java Program:
 Java is case sensitive i.e. identifier Hello and hello would have different meaning
 First letter of class name of any java program should be written in upper case. If any class name has multiple
words then every inner word’s first letter should be in upper case. (It’s only a convention rule.)
Ex. class FirstProgram
 The methods of java program should start with lower case letter. If methods name has several words then
except first word’s letter all inner word’s first letter should be in upper case.
Ex. public void getData()
 Program file name and class name both should be match.
 Program processing starts from public static void main(String args[]).
Simple Java Program
Parameters used in first Java Program:
 class is a keyword used to declare a class.
 public is an access modifier used for visibility.
 static is a keyword used to make a method as static and the advantage of static method is that there is no need
to create an object to invoke the static method.
 void is the return type and it means it does not return any value.
 main is the starting point of a program and it is name of the method.
 String args[] is used for command line argument. Here String is predefined class and args is array name.
 To print any statement, we use System.out.println(), in which System is a class, out is the reference
variable (i.e. initialized by reference data type) of PrintStream class and println() is the method of
PrintStream class.
Internal details of java programs
 At compile time by java compiler it does not interact with Operating System and converts the java code into
byte code or .class file.
Internal details of java programs
 Following steps are performed at run time:
Internal details of java programs
 Class loader – Subsystem of JVM that is used to load the class file.
 Bytecode Verifier – To check the code for illegal that can violate access right to objects.
 Interpreter – Used to read the bytecode stream and then executes the instructions.
JDK, JRE and JVM
JVM (Java Virtual Machine)
 A virtual machine that provides the run-time environment to execute the java application.
 JVM is platform dependent because the OS configuration are different from each other.
 There are following task performed by JVM:
o Loads the code
o Verifies the code
o Executes the code
o Provides runtime environment
JDK, JRE and JVM
JVM (Java Virtual Machine)
JDK, JRE and JVM
JRE (Java Run-time Environment)
 JRE provides set of software tools to develop java applications. JRE physically exist and contains set of
libraries & other files that JVM uses at runtime.
JDK, JRE and JVM
JDK (Java Development Kit)
 JDK contains all the tools that are required to develop java applications and applets. JDK physically exist.
Lecture - 2 Environment setup & JDK, JRE, JVM

More Related Content

PPTX
Java awt (abstract window toolkit)
PPT
JAVA OOP
PPT
Java Input Output and File Handling
PPTX
JAVA ENVIRONMENT
PDF
Java exception handling ppt
PPSX
Introduction to java
PPT
Java-java virtual machine
PDF
Introduction to java (revised)
Java awt (abstract window toolkit)
JAVA OOP
Java Input Output and File Handling
JAVA ENVIRONMENT
Java exception handling ppt
Introduction to java
Java-java virtual machine
Introduction to java (revised)

What's hot (20)

PPTX
Java program structure
PPTX
Arrays in Java
PPTX
JAVA AWT
PPTX
Classes objects in java
PPTX
Jdk,jre,jvm
PPT
C# Exceptions Handling
PDF
Arrays in Java
PDF
Java variable types
PPT
Exception Handling in JAVA
PPTX
I/O Streams
PPTX
Introduction to java
PPTX
Java Method, Static Block
PPTX
core java
PPTX
Core Java Tutorials by Mahika Tutorials
PPT
Jsp/Servlet
PPT
Java Basics
PPTX
History Of JAVA
PPT
Exception Handling
Java program structure
Arrays in Java
JAVA AWT
Classes objects in java
Jdk,jre,jvm
C# Exceptions Handling
Arrays in Java
Java variable types
Exception Handling in JAVA
I/O Streams
Introduction to java
Java Method, Static Block
core java
Core Java Tutorials by Mahika Tutorials
Jsp/Servlet
Java Basics
History Of JAVA
Exception Handling
Ad

Similar to Lecture - 2 Environment setup & JDK, JRE, JVM (20)

PPTX
1.introduction to java
PDF
JAVA Program Examples
PDF
Basic Java Programming
DOCX
Unit of competency
PDF
3 jre ,jdk and jvm and structure of java program.pdf
PDF
Java programming basics
PPTX
java basic for begginers
PPTX
How to run java program without IDE
PPTX
Java introduction
PPT
Introduction
DOCX
Unit2 java
PPT
Java for Mainframers
PPTX
PPT
Introduction to Java Programming
PPTX
Java-1st.pptx about Java technology before oops
PDF
Object Oriented Programming with Java Basic Syntax.pdf
PPT
Java platform
PDF
Java programming material for beginners by Nithin, VVCE, Mysuru
PDF
4 implementing java program cinouke abd execye..pdf
PPT
Javalecture 1
1.introduction to java
JAVA Program Examples
Basic Java Programming
Unit of competency
3 jre ,jdk and jvm and structure of java program.pdf
Java programming basics
java basic for begginers
How to run java program without IDE
Java introduction
Introduction
Unit2 java
Java for Mainframers
Introduction to Java Programming
Java-1st.pptx about Java technology before oops
Object Oriented Programming with Java Basic Syntax.pdf
Java platform
Java programming material for beginners by Nithin, VVCE, Mysuru
4 implementing java program cinouke abd execye..pdf
Javalecture 1
Ad

More from manish kumar (8)

PPTX
Lecture 9 access modifiers and packages
PPTX
Lecture 8 abstract class and interface
PPTX
Lecture 7 arrays
PPTX
Lecture 6 inheritance
PPTX
Lecture - 5 Control Statement
PPTX
Lecture 4_Java Method-constructor_imp_keywords
PPTX
Lecture - 3 Variables-data type_operators_oops concept
PPTX
Lecture - 1 introduction to java
Lecture 9 access modifiers and packages
Lecture 8 abstract class and interface
Lecture 7 arrays
Lecture 6 inheritance
Lecture - 5 Control Statement
Lecture 4_Java Method-constructor_imp_keywords
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 1 introduction to java

Recently uploaded (20)

PDF
Anesthesia in Laparoscopic Surgery in India
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Basic Mud Logging Guide for educational purpose
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Computing-Curriculum for Schools in Ghana
PDF
RMMM.pdf make it easy to upload and study
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
master seminar digital applications in india
PDF
Pre independence Education in Inndia.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Cell Types and Its function , kingdom of life
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Anesthesia in Laparoscopic Surgery in India
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Basic Mud Logging Guide for educational purpose
Microbial disease of the cardiovascular and lymphatic systems
human mycosis Human fungal infections are called human mycosis..pptx
Computing-Curriculum for Schools in Ghana
RMMM.pdf make it easy to upload and study
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Module 4: Burden of Disease Tutorial Slides S2 2025
Insiders guide to clinical Medicine.pdf
Pharma ospi slides which help in ospi learning
VCE English Exam - Section C Student Revision Booklet
master seminar digital applications in india
Pre independence Education in Inndia.pdf
GDM (1) (1).pptx small presentation for students
Cell Types and Its function , kingdom of life
Chapter 2 Heredity, Prenatal Development, and Birth.pdf

Lecture - 2 Environment setup & JDK, JRE, JVM

  • 2. Contents  Java Environment Set up  Simple Java Program  Internal details of Java Programs  JDK, JRE & JVM
  • 3. Environment Set up  To set path of java is required when you save source file (i.e., .java file) any where in your system except bin directories.  To set environment for java programming you must follow the steps given below:  Download JDK according to the version of Operating System.  Run the .exe file and install it.  You will need to set path to point to correct installation directories.  To set permanent path for windows: Suppose you have installed jdk in C:Program Filesjavajdk directories:  Right Click on Computer and then select Properties  Click on Advanced tab and then click on Environment Variable button  Click on new button under user variable/system variable and write variable name as path & variable value as: ‘C:Program Filesjavajdkbin'
  • 4. Environment Set up  To set temporary path for windows:  Press Window + R button on keyboard and type cmd in run prompt and click ok button (i.e. open command prompt)  Copy the path of jdk/bin directories  Type set path = copied path For Example: Set path = ‘C:Program Filesjavajdkbin’  To set path for Linux: To set the path of java in Linus is same as windows but in the case of Linux we use the export tool rather than set. Path in Linux is look like as export PATH = $PATH:/home/jdk1.6.01/bin/
  • 5. Simple Java Program To write a simple Java Program, we must know some basic points like class, object, etc. These are described briefly as follows:  Object is a real-world entity and it has state and behavior. An object can also be defined as instance of the class.  Class can be called as group of similar type of objects. Class is like a template that describe the state/behavior of objects.  Methods: We write logics, data is manipulated and all actions are executed in methods. There can be many methods in a class.  Instance Variable: Every object has its unique set of instance variable. Instance variable is declared out side the methods i.e. at class level.
  • 6. Simple Java Program First Java Program: public class FirstProgram { public static void main (String args []) { System.out.println(“First Java Program”) } } Save this file as FirstProgram.java To compile: javac FirstProgram.java To Execute: java FirstProgram Output First Java Program
  • 7. Simple Java Program Important Points of Java Program:  Java is case sensitive i.e. identifier Hello and hello would have different meaning  First letter of class name of any java program should be written in upper case. If any class name has multiple words then every inner word’s first letter should be in upper case. (It’s only a convention rule.) Ex. class FirstProgram  The methods of java program should start with lower case letter. If methods name has several words then except first word’s letter all inner word’s first letter should be in upper case. Ex. public void getData()  Program file name and class name both should be match.  Program processing starts from public static void main(String args[]).
  • 8. Simple Java Program Parameters used in first Java Program:  class is a keyword used to declare a class.  public is an access modifier used for visibility.  static is a keyword used to make a method as static and the advantage of static method is that there is no need to create an object to invoke the static method.  void is the return type and it means it does not return any value.  main is the starting point of a program and it is name of the method.  String args[] is used for command line argument. Here String is predefined class and args is array name.  To print any statement, we use System.out.println(), in which System is a class, out is the reference variable (i.e. initialized by reference data type) of PrintStream class and println() is the method of PrintStream class.
  • 9. Internal details of java programs  At compile time by java compiler it does not interact with Operating System and converts the java code into byte code or .class file.
  • 10. Internal details of java programs  Following steps are performed at run time:
  • 11. Internal details of java programs  Class loader – Subsystem of JVM that is used to load the class file.  Bytecode Verifier – To check the code for illegal that can violate access right to objects.  Interpreter – Used to read the bytecode stream and then executes the instructions.
  • 12. JDK, JRE and JVM JVM (Java Virtual Machine)  A virtual machine that provides the run-time environment to execute the java application.  JVM is platform dependent because the OS configuration are different from each other.  There are following task performed by JVM: o Loads the code o Verifies the code o Executes the code o Provides runtime environment
  • 13. JDK, JRE and JVM JVM (Java Virtual Machine)
  • 14. JDK, JRE and JVM JRE (Java Run-time Environment)  JRE provides set of software tools to develop java applications. JRE physically exist and contains set of libraries & other files that JVM uses at runtime.
  • 15. JDK, JRE and JVM JDK (Java Development Kit)  JDK contains all the tools that are required to develop java applications and applets. JDK physically exist.