Java Installation & Setup 💻

beginner
25 min

Java Installation & Setup 💻

Welcome to your Java journey with CodeYourCraft! In this comprehensive tutorial, we'll guide you through installing Java and setting up your development environment. By the end, you'll be ready to write your first Java program! 🎯

Why Java? 🤔

Java is a popular, versatile, and object-oriented programming language. It's widely used for creating Android apps, web applications, desktop applications, and even games! 🎉

System Requirements 📝

Before we dive in, make sure your computer meets the following requirements:

  • Operating System: Windows, macOS, or Linux
  • Minimum 2GB of RAM (Recommended: 4GB or more)
  • At least 1.5GB of free disk space

Java Download 🔄

  1. Visit the official Oracle Java Website
  2. Download the latest Java Development Kit (JDK) for your operating system.

Java Installation 🔧

Follow the installation instructions specific to your operating system:

  • Windows: Double-click the downloaded jdk-xx-windows-xx.exe file and follow the on-screen instructions.
  • macOS: Double-click the downloaded jdk-xx-macosx-xx.pkg file and follow the on-screen instructions.
  • Linux: Extract the downloaded archive (tar -xf jdk-xx-linux-xx.tar.gz) and follow the provided instructions to install Java.

Setting Up Your Environment Variables 📝

To verify that Java is installed correctly, we need to set up environment variables.

  1. Search for Environment Variables in your system's search bar and open the appropriate settings.

  2. In the System Variables section, find the Path variable, click Edit, and add the Java installation path (e.g., C:\Program Files\Java\jdk1.8.0_261\bin for Windows).

  3. Click New to create a new system variable and add JAVA_HOME as the variable name and the Java installation path as the variable value (e.g., C:\Program Files\Java\jdk1.8.0_261).

  4. Click OK to save the changes.

Verifying the Installation ✅

Now, let's verify that Java is correctly installed by running a simple Java program.

  1. Create a new text file named HelloWorld.java and copy the following code:
java
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }
  1. Save the file in a convenient location, such as your desktop.

  2. Open a command prompt or terminal, navigate to the location where you saved the HelloWorld.java file, and run the following command:

  • Windows: javac HelloWorld.java && java HelloWorld
  • macOS/Linux: javac HelloWorld.java && java HelloWorld

If everything is set up correctly, you should see Hello, World! printed in your console! 🎉

Quiz 📝

Quick Quiz
Question 1 of 1

What do we call the Java Development Kit (JDK) package downloaded from the official Oracle website?

Now you've successfully installed and set up Java! In the next tutorial, we'll dive into writing our first Java program. Let's get coding! 🎯