Introduction to JAVA
About Java
• Java is a powerful and versatile programming
language for developing software running on
mobile devices, desktop computers, and servers
• Developed by James Gosling in 1995
• Popular because of write a program once and run
it anywhere
• Java is a programming language and a platform
• Platform: Any hardware or software environment
in which a program runs, is known as a platform.
Since Java has a runtime environment (JRE) and
API, it is called a platform.
Types of Java Applications
• Four types of applications that can be created
using Java programming
– Standalone Application
– Web Application
– Enterprise Application
– Mobile Application
JDK Editions
• Java Standard Edition (Java SE)
• Java Enterprise Edition (Java EE)
• Java Micro Edition (Java ME)
JDK Versions
• History of JDK version
– https://en.wikipedia.org/wiki/Java_version_history
• Latest is Java SE 18 [Java SE 18]
• Download from:
– https://www.oracle.com/java/technologies/downloa
ds/#jdk18-windows
Installing Java
• To check if Java is installed (open command
prompt and type following command)
java –version
• Setting Java Path
– Temporary Path
• Open the command prompt
• Copy the path of the JDK/bin directory
• Write in command prompt: set path=copied_path
– Permanent Path using Environment Variables
Settings
Environment Variable
• Go to "System Properties" (Can be found on Control Panel
> System and Security > System > Advanced System
Settings)
• Click on the "Environment variables" button under the
"Advanced" tab
• Then, select the "Path" variable in System variables and
click on the "Edit" button
• Click on the "New" button and add the path where Java is
installed, followed by bin. By default, Java is installed in
C:Program FilesJavajdk-15bin
Then, click "OK", and save the settings
• At last, open Command Prompt (cmd.exe) and type java -
version to see if Java is running on your machine
Popular Java IDEs
• NetBeans
• Eclipse
• IntelliJ
JDK, JRE, and JVM
• Java Virtual Machine (JVM)
– Provides a platform-independent way of executing Java source
code
– JVM comes with JIT(Just-in-Time) compiler that converts Java
source code into low-level machine language
• Java Runtime Environment
– Set of software tools which are used for developing Java
applications
– Contains JVM
– JRE = JVM + rt.jar (lang, util, awt, swing, math packages)
• Java Development Tool kit (JDK)
– Software development environment which is used to develop
Java applications
– Physically exists
JDK, JRE, and JVM
Interpreting/Compiling Source Code
• A program written in a high-level language is
called a source program or source code
• A source program must be translated into
machine code for execution
Compiling Source Code
A compiler translates the entire source code into a
machine-code file, and the machine-code file is
then executed
Interpreting Source Code
An interpreter reads one statement from the
source code, translates it to the machine code or
virtual machine code, and then executes it right
away
Creating, Compiling, and
Running Programs
Java Program Phases
• Phase 1: Creating a Program
• Phase 2: Compiling a Java Program into Bytecodes
– Bytecodes are re-executed by the JVM
Java Program Phases
• Phase 3: Loading a Program into Memory
– JVM class loader takes the .class file (along with
associated class files provided by Java) and loads
in memory
Java Program Phases
• Phase 4: Bytecode Verification
– Java enforces strong security to make sure that Java
programs arriving over the network do not damage your
files or your system (as computer viruses and worms
might).
Java Program Phases
• Phase 5: Execution
– Interpreter
• JVM execute bytecode using interpreter (one bytecode at a time) which
slows execution
– Just In Time(JIT) Compiler
• JVM analyzes the bytecodes as they’re interpreted searching for hot
spots — parts of the bytecodes that execute frequently
• For these part JIT also known as Java HotSpot compiler
– Translates the bytecodes into the underlying computer’s machine language

Lecture-2.pptx sensor design and signal processing using RF and THz sensing, specifically for physiological measurements. He is highly motiv

  • 1.
  • 2.
    About Java • Javais a powerful and versatile programming language for developing software running on mobile devices, desktop computers, and servers • Developed by James Gosling in 1995 • Popular because of write a program once and run it anywhere • Java is a programming language and a platform • Platform: Any hardware or software environment in which a program runs, is known as a platform. Since Java has a runtime environment (JRE) and API, it is called a platform.
  • 3.
    Types of JavaApplications • Four types of applications that can be created using Java programming – Standalone Application – Web Application – Enterprise Application – Mobile Application
  • 4.
    JDK Editions • JavaStandard Edition (Java SE) • Java Enterprise Edition (Java EE) • Java Micro Edition (Java ME)
  • 5.
    JDK Versions • Historyof JDK version – https://en.wikipedia.org/wiki/Java_version_history • Latest is Java SE 18 [Java SE 18] • Download from: – https://www.oracle.com/java/technologies/downloa ds/#jdk18-windows
  • 6.
    Installing Java • Tocheck if Java is installed (open command prompt and type following command) java –version • Setting Java Path – Temporary Path • Open the command prompt • Copy the path of the JDK/bin directory • Write in command prompt: set path=copied_path – Permanent Path using Environment Variables Settings
  • 7.
    Environment Variable • Goto "System Properties" (Can be found on Control Panel > System and Security > System > Advanced System Settings) • Click on the "Environment variables" button under the "Advanced" tab • Then, select the "Path" variable in System variables and click on the "Edit" button • Click on the "New" button and add the path where Java is installed, followed by bin. By default, Java is installed in C:Program FilesJavajdk-15bin Then, click "OK", and save the settings • At last, open Command Prompt (cmd.exe) and type java - version to see if Java is running on your machine
  • 8.
    Popular Java IDEs •NetBeans • Eclipse • IntelliJ
  • 9.
    JDK, JRE, andJVM • Java Virtual Machine (JVM) – Provides a platform-independent way of executing Java source code – JVM comes with JIT(Just-in-Time) compiler that converts Java source code into low-level machine language • Java Runtime Environment – Set of software tools which are used for developing Java applications – Contains JVM – JRE = JVM + rt.jar (lang, util, awt, swing, math packages) • Java Development Tool kit (JDK) – Software development environment which is used to develop Java applications – Physically exists
  • 10.
  • 11.
    Interpreting/Compiling Source Code •A program written in a high-level language is called a source program or source code • A source program must be translated into machine code for execution
  • 12.
    Compiling Source Code Acompiler translates the entire source code into a machine-code file, and the machine-code file is then executed
  • 13.
    Interpreting Source Code Aninterpreter reads one statement from the source code, translates it to the machine code or virtual machine code, and then executes it right away
  • 14.
  • 15.
    Java Program Phases •Phase 1: Creating a Program • Phase 2: Compiling a Java Program into Bytecodes – Bytecodes are re-executed by the JVM
  • 16.
    Java Program Phases •Phase 3: Loading a Program into Memory – JVM class loader takes the .class file (along with associated class files provided by Java) and loads in memory
  • 17.
    Java Program Phases •Phase 4: Bytecode Verification – Java enforces strong security to make sure that Java programs arriving over the network do not damage your files or your system (as computer viruses and worms might).
  • 18.
    Java Program Phases •Phase 5: Execution – Interpreter • JVM execute bytecode using interpreter (one bytecode at a time) which slows execution – Just In Time(JIT) Compiler • JVM analyzes the bytecodes as they’re interpreted searching for hot spots — parts of the bytecodes that execute frequently • For these part JIT also known as Java HotSpot compiler – Translates the bytecodes into the underlying computer’s machine language