Welcome back to the Java Tutorial series…
In the previous chapter we got introduced to the world of Java and understood why you should learn Java. In this chapter, let’s get started with setting up Java development environment to start writing Java programs.
To develop and run Java programs, you need to install Java in your machine (laptop or desktop).
Start with visiting official download page of Java Development Kit (JDK) at Oracle’s website. Official Oracle Website
Depending on your operating system (either Windows/Linux/macOS), you may want to visit the respective section, download and install the respective JDK installer.
Once the installation is completed, start your terminal or command prompt to check if Java is installed correctly or not, by running this command:
>> java –version
If Java is installed correctly you will get a message similar to the one given below mentioning the version of the Java JDK installed in your machine.
>>
java version "22" 2024-03-19
Java(TM) SE Runtime Environment (build 22+36-2370)
Java HotSpot(TM) 64-Bit Server VM (build 22+36-2370, mixed mode, sharing)
If “java” keyword is unrecognized or not detected, it is likely that it might not be installed or configured correctly.
If you are using Windows, you may be required to go through an additional step of adding the Java JDK path to Environment’s “Path” variable.
Once Java is installed in your system, you are ready to run your first Java program. You can run java programs in 2 ways:
Let’s check out how you can run your Java programs in command line…
>> javac Main.java
>> java Main
Congratulations! You have successfully ran your first Java program.
In real life projects, Professional Java developers use a Java IDE such as Eclipse, Netbeans, Jetbrains IntelliJ Idea or Visual Studio Code (VSCode) to work on Java projects. In upcoming chapters, we shall work using Eclipse IDE to write and execute our Java programs.
I hope you liked reading this tutorial. See you in the next tutorial.
Next Chapter Chapter 3 - Writing first Java program in Eclipse
Fully customizable CRM Software for Freelancers and Small Businesses