Java Installation and First Project


Java is one of the most preferred programming languages today. In this article, we will explain step by step how to set up Java and create your first project. Java offers great flexibility to developers thanks to its ability to run on many platforms. Now let's start with the installation of Java.

How to Install Java?

Before starting Java installation, we need to download the Java Development Kit (JDK). JDK is a kit that contains the tools needed for Java developers. Follow these steps to download the JDK:

<a href="https://www.oracle.com/java/technologies/javase-jdk11-downloads.html">Download Java JDK</a>

After the JDK download is complete, you can install Java on your computer by running the setup file. During installation, the installer will ask you for the necessary permissions.

Setting Environment Variables

After installation is complete, you will need to set some environment variables so that Java can function properly on your system. To set the JAVA_HOME and PATH variables in your system, follow these steps:

1. Right-click on My Computer and click on "Properties."
2. Go to "Advanced system settings."
3. Click on "Environment Variables."
4. Click the "New" button to add the JAVA_HOME variable and enter the path where the JDK is installed (for example: C:\Program Files\Java\jdk-11.0.10).
5. Also add the path of the JDK's bin folder to the PATH variable (for example: %JAVA_HOME%\bin).

Creating Your First Java Project

After completing the Java installation, you can start designing your first project with a simple Java application. Let's write your first project by following the steps below:

public class MerhabaDunya {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

Save the code above as a file: MerhabaDunya.java. Then, go to the project folder in the command prompt and compile and run your program by executing the following commands:

javac MerhabaDunya.java
java MerhabaDunya

If everything is set up correctly, you should see the message 'Hello World!'. This is the first successful project you wrote with Java.

Conclusion

Installing Java and creating your first project is an important step as a developer. By following the steps in this article, you can successfully install Java on your computer and easily create your first project. You can reinforce this basic knowledge by developing more complex projects with Java.