In this blog post, I will give a detailed view of creating the first java program in eclipse for java programming in the Windows 11 Operating System.
1. Before the installation, we need to check whether java is installed or not. Click on the search icon and search for cmd.
2. Once the command prompt opens, type java -version and press enter. If you see this kind of message which is displayed in the image below, then java is not installed in your Windows 11 Operating System.
3. To install java, open a web browser of your choice and search for java JDK download. Click on the first link.
4. Once the link opens, scroll down and click on Windows. Then click the link next to x64 Installer. It will start to download.
5. Once the download is complete, click on the exe file and minimize the browser. It will show a warning. Click on Yes.
6. In the installer window, click on Next.
7. This will be the location where java will be installed. If you want to change the location, then click on the Change option. I am going to leave it as default and click on Next.
8. It will start the installation process. It will display the installation successful message. Click Close on that window.
9. Now, open File Explorer and go to the location where java is installed. Click on the java folder.
10. To set the environment variable for java, click on the search icon and type Edit Environment and click on the search result.
11. It will open this kind of window. Click on the path under system variables. Then, click on Edit. Here, you need to add the path. Go to the bin folder and copy the path. You can either double click or click on New. Then, paste the path. Press Enter. It will add the path. Then, click on Ok. Some applications need java home environment variables.
12. To set a home environment variable, you need to click on the New under the user variable section.
13. Here, you need to provide the variable name as JAVA_HOME and the variable value will be the folder. Just copy the path to the JDK folder and don’t go inside the bin folder. Paste that path into a variable value. Click on Ok.
14. Once you have installed java and the environment variable, you can view java in the command line. Click on the search icon and type cmd. Once the command prompt window opens, type java -version and press enter. You will be able to see the latest version of java.
15. To compile a java file, you need to use the javac command. Type javac -version and press enter. You will be able to see the javac version on the screen.
16. Now, open a web browser of your choice and search for eclipse ide. Click on the first link.
17. Once the link opens, click on the download button at the top.
18. It will redirect you to another page. Scroll down and click on the download button for 64 bit.
19. It will redirect you to another page. Click on the download button on that page. It will start to download.
20. Once the download is complete, click on the exe file and minimize the browser. When the eclipse installer starts, you need to select the purpose for which you are installing. I am going to select the first option which is for java developers.
21. Since I have already installed java in my Windows 11 operating System eclipse will recognize that path. This will be the location where it will be installed. If you want you can change the path. Then click on the Install button.
22. In the license agreement window, click on Accept Now button. It will start the installation.
23. When it is successfully installed, click on the Launch button. A shortcut will also appear on your desktop.
24. When you start eclipse ide for the first time, it will ask you to provide the workspace folder. If you want you can change the default folder by clicking on the Browse option. I am going to leave it as default. So, check that checkbox and click on the Launch button.
25. Eclipse IDE will look like this. Click on Create a new java project. Click on minimize button to minimize the welcome window. Close the donate tab. Click on create a java project.
26. You have to provide a name for your java project. I am going to name the project hello. This will be the default location where it will be saved. If you have installed Java JDK separately, you can choose the second option under JRE. For the JDK version, select 17. I am going to leave the project layout as default and click on Next.
27. In the next window, I am going to leave everything as default and click on the Finish button.
28. In the module name, I am going to leave it as default. Check the checkbox and click on Create.
29. It will create a project for you. I am going to remove the java file as I am going to create my own java class. Right-click and click on New Class.
30. I am going to name the class Hello. The modifier will be public. For the method, I am going to choose a public static void main. Then, click on Finish.
31. If you want to change the font size, click on Window and preferences. Here, you need to click on general and select appearance. Expand that option and click on colors and fonts. From here, click on Java and click on java editor text font. Then, click on Edit.
32. It will allow you to change the font and font size. After changing it, click on Apply.
33. Now the font size has been increased. I am going to write a very simple code. After writing the code, click on the Run Hello.java icon. It will run your code. The output will be displayed.
These are the steps for creating the first java program in eclipse for java programming in Windows 11 Operating System.