Setting up the Development Environment for Java Programming
Java Runtime Environment (JRE)
• JRE is a software package that includes the Java Virtual Machine (JVM), Java class
libraries, and other components necessary to run Java programs.
• JRE allows you to run Java programs on your computer, but you cannot use it to create
new Java applications.
Installing JRE
• Go to the Java SE Downloads page.
• Download and install the latest version of JRE for your operating system.
Java Development Kit (JDK)
• JDK is a software development kit that includes the JRE, tools for developing Java
applications, and the Java compiler.
• JDK allows you to create, compile, and run Java applications.
Installing JDK
• Go to the Java SE Downloads page.
• Download and install the latest version of JDK for your operating system.
Integrated Development Environment (IDE)
• An IDE is a software application that provides a graphical user interface for writing,
testing, and debugging code.
• IntelliJ IDEA is a popular IDE for Java development.
Installing IntelliJ IDEA
• Go to the IntelliJ IDEA Downloads page.
• Download and install the latest version of IntelliJ IDEA for your operating system.
Writing and Running the First Java Program
• Open IntelliJ IDEA and create a new Java project.
• Create a new Java class and write the following code:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
• Click the "Run" button to compile and run the program. The output should be:
Hello, world!
Creating a New Java Project
• Open IntelliJ IDEA and click "New Project".
• Select "Java" as the project type and choose a location to save the project.
• Click "Finish" to create the project.
Project Structure
The project structure consists of the following components:
• Source root: a directory that contains your Java source files.
• Classes: a directory that contains the compiled Java class files.
• Libraries: a directory that contains third-party libraries.
• Resources: a directory that contains non-code resources, such as images or configuration
files.
Java Programming Language
• Java is a high-level, object-oriented programming language.
• Java was created by James Gosling and released in 1995.
• Java is platform-independent, meaning that Java programs can run on any operating
system.
Java Syntax and Data Types
• Java uses a syntax that is similar to C and C++.
Java has several data types, including:
• boolean: a data type that can have a value of true or false.
• byte: a data type that can hold a 8-bit signed integer.
• short: a data type that can hold a 16-bit signed integer.
• int: a data type that can hold a 32-bit signed integer.
• long: a data type that can hold a 64-bit signed integer.
• float: a data type that can hold a 32-bit floating-point number.
• double: a data type that can hold a 64-bit floating-point number.
• char: a data type that can hold a single character.
• String: a data type that can hold a sequence of characters.