0% found this document useful (0 votes)
7 views5 pages

Java Features and Security Overview

Uploaded by

Sachin Mishra
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

Java Features and Security Overview

Uploaded by

Sachin Mishra
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

‭Java Introduction‬

‭Features:‬

‭1.‬ ‭Platform Independence (Write Once, Run Anywhere):‬


‭2.‬ ‭Automatic Memory Management (Garbage Collection):‬
‭ .‬ S
3 ‭ ecurity‬
‭4.‬ ‭Distributed Computing (RMI, Java EE):‬
‭5.‬ ‭Vast Libraries‬

‭Why Java is considered a Secure Language‬

‭1.‬ B
‭ ytecode Verification‬‭: When Java source code is compiled,‬‭it's translated into‬
‭bytecode. Before executing bytecode, the JVM performs bytecode verification to‬
‭ensure it adheres to certain safety constraints, preventing various types of‬
‭security vulnerabilities such as buffer overflows and invalid memory access.‬
‭Verification Process‬‭:‬
‭Class File Structure Verification‬‭: The JVM first verifies‬‭the structure of the class‬
‭file to ensure it conforms to the required format.‬

‭ tatic Verification‬‭: This involves checks on the bytecode‬‭without executing it,‬


S
‭verifying that the bytecode is well-formed and adheres to Java language rules.‬
‭This includes checking for correct use of data types, valid method calls, operand‬
‭stack manipulation, etc.‬

‭ ype Safety Verification‬‭: This ensures that type safety‬‭is maintained throughout‬
T
‭the bytecode. For example, operations are performed on compatible data types‬
‭and that type casts are valid.‬

‭ here are no operand stack overflows or underflows‬


T
‭The types of the parameters of all bytecode instructions are known to always be‬
‭correct‬
‭Object field accesses are known to jvm or protected‬

‭2.‬ S
‭ andboxing‬‭: Java's security model includes a concept‬‭called the "sandbox,"‬
‭which restricts the actions that Java code can perform. For example, Java‬
‭applets running in a web browser operate within a restricted environment‬
(‭ sandbox) that limits their access to the system resources, such as the file‬
‭system or network, mitigating the risk of malicious behavior.‬
‭ .‬ ‭Secure Standard Library‬‭: Java's standard library (Java‬‭API) includes‬
3
‭security-focused classes and utilities for tasks such as cryptography, secure‬
‭communication (e.g., HTTPS), authentication, and authorization, making it easier‬
‭for developers to implement secure solutions.‬
‭4.‬ ‭String Immunity‬‭: In Java, strings are immutable, meaning‬‭once created, they‬
‭cannot be modified. This property helps prevent certain types of security‬
‭vulnerabilities, such as string manipulation attacks.‬

‭JDK vs JRE vs JVM‬

‭Java Development Kit (JDK)‬


‭ .‬ J
1 ‭ DK is a comprehensive software development kit for building Java applications.‬
‭2.‬ ‭It includes tools and utilities for developing, debugging, and monitoring Java‬
‭programs.‬
‭3.‬ ‭JDK contains the Java compiler (‬‭ ‭) to compile‬‭Java source code into‬
javac‬
‭bytecode.‬
‭4.‬ ‭It also includes the JRE, development tools (e.g.,‬‭
javap‬ ‭,‬‭ ‭),‬
javadoc‬
‭5.‬ ‭JDK is necessary for developing Java applications, as it provides everything‬
‭needed to compile, debug, and run Java code.‬

‭Java Runtime Environment (JRE)‬


‭1.‬ J ‭ RE is a subset of the JDK and provides the runtime environment for executing‬
‭Java applications.‬
‭2.‬ ‭It includes JVM, Java libraries (such as‬‭ ‭),‬‭and other necessary files to run‬
[Link]‬
‭Java programs.‬
‭3.‬ ‭JRE does not contain development tools like the compiler or debugger; it is‬
‭meant solely for running Java applications.‬

‭Java Virtual Machine (JVM)‬


‭1.‬ J
‭ VM is an abstract computing machine that provides the runtime environment‬
‭for executing Java bytecode.‬
‭2.‬ I‭t is a specification , several vendors provided the implementation for the JVM.‬
‭Different JVM available in the market like Oracle HotSpot, OpenJ9 etc.‬
‭3.‬ ‭JVM interprets bytecode or just-in-time (JIT) compiles it into native machine‬
‭code for execution.‬
‭4.‬ ‭JVM manages memory, garbage collection, and other runtime activities.‬

‭Internal Working of JVM‬

‭Class Loader Subsystem‬


‭It is mainly responsible for 3 activities‬
‭1.‬ ‭Loading‬
‭2.‬ ‭Linking‬
‭3.‬ ‭Initialization‬

‭ . Loading:‬‭Loading means reading the .class file‬‭data from hard disk and store corresponding‬
1
‭data in method area‬
‭For each .class file, JVM will store‬
‭Fully qualified class name, fully qualified class name of parent, method and constructor‬
‭information, constant pool information‬
‭2. Linking:‬‭It consist of 3 activities‬
‭a)‬ ‭Verification‬
‭b)‬ ‭Preparation‬
‭c)‬ ‭Resolution‬

‭ erification:‬‭It is the process of ensuring that bytecode‬‭representation is correct or not,‬


V
‭bytecode verifier is responsible for this activity‬
‭Preparation:‬‭In this Phase, JVM will allocate memory‬‭for class level static variables and‬
‭assigned default values‬
‭Resolution:‬‭It is the process of replacing all symbolic‬‭reference used in our class with original‬
‭direct reference from method area. Name of these classes are stored in constant pool‬

‭3. Initialization‬
‭In this phase, values are assigned to the variables‬‭and the static block will be executed‬

‭Different Types of Class Loaders‬


‭ .‬ B
1 ‭ ootstrap Class Loaders‬
‭2.‬ ‭Extension Class Loaders‬
‭3.‬ ‭Application Class Loaders‬

‭Memory Model of JVM‬

‭Method Area‬
‭●‬ T ‭ he Method Area stores metadata about classes and interfaces, such as the fully‬
‭qualified class names, field names, method names, method signatures, access‬
‭modifiers, and constant pool information. This metadata is required for proper‬
‭class loading, verification, and runtime execution.‬
‭●‬ ‭The constant pool, which contains symbolic references, literals, and other‬
‭constant values used by the class, is stored in the Method Area. This includes‬
‭string literals, numeric constants, class and interface names, method and field‬
‭references, and more.‬

‭Heap Area‬
‭ .‬ T
1 ‭ he Heap Area is where objects created by Java programs are allocated‬
‭2.‬ ‭The Heap Area supports dynamic memory management through garbage‬
‭collection.‬
‭3.‬ ‭Arrays and strings in Java are also stored in the Heap Area‬

‭It is logically divided into two main component‬


‭a)‬ ‭Young Generation‬
‭b)‬ ‭Old Generation‬

‭Execution Engine‬
‭ xecution Engine‬
E
‭Just In Time (JIT) Compiler‬

You might also like