0% found this document useful (0 votes)
17 views7 pages

Java Overview: JSE, JEE, JME Essentials

Java, created in 1991 by James Arthur Gosling's team, is an object-oriented, platform-independent programming language released in 1995. It has three main editions: JSE for standard applications, JEE for enterprise applications, and JME for mobile devices. Key features include automatic garbage collection, strong exception handling, and the ability to run on any system with a Java Virtual Machine (JVM).

Uploaded by

Milky Way
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)
17 views7 pages

Java Overview: JSE, JEE, JME Essentials

Java, created in 1991 by James Arthur Gosling's team, is an object-oriented, platform-independent programming language released in 1995. It has three main editions: JSE for standard applications, JEE for enterprise applications, and JME for mobile devices. Key features include automatic garbage collection, strong exception handling, and the ability to run on any system with a Java Virtual Machine (JVM).

Uploaded by

Milky Way
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

Java Language History


• Java was created by a team of members called "Green" led
by James Arthur Gosling.
• When Java was created in 1991, it was originally called
Oak.
• It is a free and software (FOSS) under GNU General Public
License (GPL)
• First version of Java was released in 1995.
• Java is an Object-oriented language, simple, portable,
platform independent, robust and secure.
• We will look at Java 1.8.
Flavours Of Java
• JSE
o Java Standard Edition, formerly known as J2SE
o Is a part of Java language
• JEE
o Java Enterprise Edition, formerly known as J2EE
o Is a set of packages used to develop distributed
enterprise-scale applications
o The applications are deployed on JEE application
servers
• JME
o Java Micro Edition was formerly known as JME.
o These are the set of packages for application
development for mobile devices and embedded
systems

Sample Java Program


[Link]
public class Hello{
public static void main(String args[]) { Main () is a
[Link] (“Hello World!"): method from
}} where program
execution starts in
java
Statement used to display values on the console ‘println’ causes
the output on new Iine.

Java Development Environment for Compilation & Execution


. Compile java programs
• From command prompt
➢ Through an IDE (Integrated development
environment)
• Eclipse ->Apache
➢ NetBeans >Oracle SON
➢ JBuilder -> Borland
➢ Integrated Development Environment -> IDE

Introducing Eclipse – IDE


• IDE stands for Integrated Development Environment It is
where the’ Java programs are written, compiled and
executed

• Eclipse is an open-source project


o Launched in November 2001
o Designed to help developers with specific
development tasks

• GUI and non-GUI application development support


• Easy integration of tools
• Supported by multiple OS like Windows, Mac, Linux,
Soars, IBM
• AIX and HP-UX.
• Java Development Tooling (JD) is used for Java code build.
• Provides a set of workbench plug-ins for manipulating Java
code
o Java projects, packages, classes, methods, …
• Java compiler is built-in
o Used for compiling Java code
o Creates errors (special markers of code) if
compilation fails
• Numerous content types support
o Java, HTML, C, XML, …

Working with Different Workspaces


• It is possible to run different workspaces using command
prompt
o Data argument must be used with [Link]
• Workspace location must be specified
• Useful for grouping project specific data
• Multiple workspaces can run at the same time

Features of Java Language


• Simple
• Object oriented language:
• Portable and platform independent
• Robust
• Multithreaded
• Dynamic Linking
• Secure
• Performance
Portable & Platform Neutral
• Java Code can be compiled anywhere
• Bytecode can be executed anywhere
Portable
• When java code executes, is behaviors exactly same in any
aware system
• There are no platform-specific code in java programs that
causes compilation problems in any other OS.
• This makes Java program portable
Platform Independent
• A Java program requires a JVM (part of the JRE) to execute
Java code, When Java application starts, Java Virtual
Machine also starts.
• Bytecode has instructions that Java Virtual Machine can
understand and execute.
• JVM converts the Bytecode to machine specific code.
• Java Bytecodes can be copied onto any machine that has
JVM and executed. This is what makes Java Platform
Independent.
• “Write Once, Run anywhere’
• Is JVM platform independent? NO IT’S DEPENDENT

JVM: Perspectives
• JVM can be looked as
o A runtime instance: JUM Ife cycle begins when
applications. Stars to run (that is, when main method
is called) and ends when the application ends.
o The abstract speciation: Specification that Java team
at Sun (Oracle), provides which tell JVM makers now
they must design JVM for their OS.
o A concrete implementation: JVM that is built
specifically targeted for n OF based on abstract
specification
Interpreter vs. JIT
• Java Bytecodes were originally designed to be interpreted
by the JVM meaning bytecodes are translated to machine
code without it being stored anywhere.
• Since bytecodes verifier (which is part of the JVM)
performs runtime checks, line by
line execution was important.
• Since speed became an issue, Justin-Time Compilation (JIT)
came into being. JIT converts chunks of code, stores
temporarily in memory and then executes the converted
code.
• JIT compilers are typically bundled with or are a part of
virtual machine and do the conversion to native code at
runtime, on demand.
• The compiler also does automatic register allocation and
some optimization when It produces the bytecodes.
Therefore, JIT is hybrid campers.
Handling Errors in Java
• Compilation error: generated by the compiler. Examples of
situations where it arises:
o Incorrect syntax, racket mismatch, if keywords are
used as variables
o Using uninitialized variables
o Unreachable code: while (false) {..}
o Strong type checking
• Run-time error: generated by the JVM.
• Examples of situations when it arises:
o Attempt to divide an integral value by 0 or access
array index beyond the defined range.
o Trying to access a class that does not exist at runtime.
(What happens if you delete Hello class and then run
Hello.
• Java has a strong exception handling mechanism that allows
Programmers to handle such errors and come out of the
situation Graceful.

Automatic Garbage Collection


• The garbage collector is a tool that frees up any
unreferenced memory (memory occupied by objects that
are no longer in use by the program) in programs.
• Automatic garbage collection is an integral part of Java and
its run-time system,
• Java technology has no pointers. Hence, no question of
allocating and freeing memory by programmers.
• Does that mean Java does not support dynamic memory
allocation?

➢ No. It means that Java takes care of memory and


relieves the. Programmers from memory-related
hassles.

• java—verbose:gc can be used to get more information about


garbage collection process.

Classpath
• Classpath is an environment variable hat a Java compiler
and JVM (system class loader) use 10 locate the classes in
the file system.
• To set the classpath temporarily in command line
SET CLASSPATH=directory;%CLASSPATH%;.
• Command to set classpath while compiling
javac classpath dirt;dir2 [Link]
Example: javac-classpath C:/MyJava
• Command to specify un-complied source file to be compiled
and included in the classpath
Javac — sourcepath dir1;dir2 Someclass
Example: javac -sourcepath C:/MyJava
• Providing calsspath while executing
Java classpath directory 1;directory2
Commenting Source Code
• Question:
o Why should you comment your code? The essential
purpose is to enhance the readability and
interpretability of programs
o How much should you comment? As you want
• 3 types of comment
➢ Single line comment: //
// This is a single line comment
➢ Multi-line comment: / **/
/* this is multi
Line comment */
➢ Documentation Comment (Doc comment): /** */
/**This class is used to represent a stack.
* @author Murali
*@version 1.0, 08/1612010
*/

How to nest the comments


Valid Nesting
/*//*/ /**//*/

Invalid Nesting
/**/ and /** */ nested with it and with each other gives error
/* /**/*/
/** /* */*/

Guidelines for Doc Comments


• Who owns and edits the Doc Comments: usually the
programmer?
• Doc comments of classes, methods, fields:
• Brief description of what does. In as longer description
required, ink to an external document (word, pdf) can be
included.
• For methods, whether they are thread-safe and what runtime
exception they throw must be specified.
• Proper indentation of documentation for better readability.
For More Information, refer
[Link]
/

Javadoc
• Tool that is used to produce HTML pages by parsing
through the documentation comment in java Source code.
• Produces documentation for public and protected
classes/members
• Works on entire package or a single source file
• Usage of source file
Javadoc sourcefilename. Java
Javadoc [Link]

Annotation
• Annotations are extra text starting with @ symbol that is
added in the Java. Program to provide information about a
program.
• Annotations do not directly affect program semantics.
• They provide information about the program to fools and
libraries, which can in turn affect the semantics of the
running program.
• Annotations can be read from source files, class files, or
reflectively at run time.
Annotation uses
• Annotations for the compiler
• Example:
o @SuppressWarnings: can be used by the compiler
to detect errors or suppress warnings.
• Annotations for the application servers and tools
o Application server tools can process annotation
information generate code etc. For services it
provides like security etc.
• javadoc tool uses annotations like
o @author, @version, @param, @return
• Runtime processing — Some annotations are available to
be examined at runtime

Common questions

Powered by AI

Automatic garbage collection in Java's runtime environment improves program reliability by managing memory allocation and deallocation without direct programmer intervention. It frees memory occupied by unreachable objects, preventing memory leaks and reducing potential crashes. However, the garbage collector also introduces performance considerations as it periodically consumes CPU resources during its cleaning cycle. Nonetheless, Java optimizes this process to minimize impact and ensure efficient application performance. By abstracting memory management complexities, Java enables developers to focus on application logic rather than resource handling .

Java automates memory management through its garbage collection mechanism, which automatically frees memory by removing objects that are no longer in use. This negates the need for programmers to manually allocate and deallocate memory, as seen in languages that support pointers. In such languages, incorrect memory handling can lead to leaks and corruption, whereas Java's approach simplifies programming and improves reliability by ensuring that developers do not need to manage memory manually. Java’s lack of pointers and reliance on automatic garbage collection mitigate memory-related errors significantly .

Java's platform independence is enabled by its Bytecode and the Java Virtual Machine (JVM). The Java compiler converts Java source code into Bytecode, which is a set of instructions that can be executed on any system equipped with a JVM. The JVM interprets and converts this Bytecode into machine-specific code, allowing it to run on different operating systems without modification. This mechanism is summarized by the phrase "Write Once, Run Anywhere". Though the Bytecode is platform independent, the JVM itself is platform dependent, as there needs to be a specific implementation for each operating system .

Commenting in Java programming is critical for code readability and maintainability. It provides context and explanations for complex code blocks, helping other developers understand the purpose, logic, and functionality without requiring deep analysis of the code itself. Proper documentation can guide future modifications and debugging, reducing potential errors and easing collaboration. It encompasses single-line, multi-line, and documentation comments, enhancing interpretability and code structure understanding, thereby supporting long-term project sustainability and adaptability .

Java ensures secure execution primarily through bytecode verification in the JVM, which checks bytecode for illegal code that could breach access restrictions. This includes verifying stack management, type-safety, and constraint adherence, thus ensuring that the executed code cannot perform unauthorized operations. The JVM further enhances security by creating a controlled execution environment that restricts the interaction of Java applications with the underlying system, thereby minimizing vulnerabilities to attacks and unauthorized resource access .

Integrated Development Environments (IDEs) like Eclipse significantly enhance Java development by providing comprehensive tools for writing, compiling, and debugging code within a single interface. Eclipse offers features such as syntax highlighting, code completion, error-checking, project management, integrated version control, and visual debugging. Additionally, Eclipse supports multiple languages and frameworks through plugins, facilitating a wide range of development tasks beyond Java. These features streamline the development process, reduce overheads in setup and management, and increase overall productivity by providing immediate feedback and a cohesive environment .

Just-In-Time (JIT) compilation enhances Java performance by converting Bytecode into native machine code at runtime, rather than interpreting it line by line. This process significantly reduces runtime because the conversion happens once, and the translated code is stored and executed directly from memory thereafter. This approach contrasts with pure interpretation, where each line of code is translated every time it runs, leading to slower execution. JIT achieves faster execution speeds by optimizing code further with techniques such as automatic register allocation .

The different flavors of Java are designed to cater to specific application needs. Java Standard Edition (JSE) is intended for general-purpose programming and includes core Java libraries and functionalities for writing standalone applications. Java Enterprise Edition (JEE) extends JSE with specifications for distributed enterprise-level applications, offering APIs for web services, component models, and communication protocols. Java Micro Edition (JME) focuses on embedded systems and mobile devices, providing a smaller footprint of Java libraries and optimized runtime environments. Collectively, these editions allow Java to target an extensive range of applications, from desktop and server environments to constrained device settings .

Java's object-oriented nature contributes to its robustness and security through encapsulation, inheritance, and polymorphism. Encapsulation restricts access to an object's internal state and ensures that data is modified only through well-defined interfaces, thereby reducing the risk of unintended interactions and errors. Inheritance promotes code reusability and the establishment of hierarchical class structures, which can easily be managed and extended. Polymorphism allows for dynamic method invocation and flexible code architecture. These principles help maintain code quality, prevent security breaches, and allow the creation of more secure and reliable applications .

Annotations in Java provide metadata about the program to tools and libraries without altering the program's actual logic. They can influence program behavior by providing information to compilers and applications such as suppressing warnings (@SuppressWarnings), enhancing documentation (@author, @version) or runtime operations by enabling frameworks to automatically generate code or configure settings based on the annotated data. This makes them vital for simplifying code base configurations, improving readability, and supporting automated processes such as building development tools .

You might also like