How to Create First Java Program in Eclipse for Java Programming Windows 11

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so because eclipse is a java based ide you need to have java installed on your windows 11 operating system so let's see how we can install java so first of all we are going to check whether java is already installed on our windows operating system or not for this you can just click on the search icon and then search for cmd and then just open the command prompt and once command prompt opens you can type this command here java space hyphen version okay and then press enter and if this command shows java is not recognized as an internal or external command that means java is most probably not installed on your windows 11 operating system so let's see how we can install it so for that first of all open your favorite browser and search for java jdk download and the first link which will appear here will be from oracle.com forward slash java forward slash technologies forward slash download so just click on this link i'm going to provide this link in the description of this video also so you can directly come to this website and here you just need to scroll down at the time of making this video java 17 is the latest version which is available for download so when you scroll down you will see the option to download the linux binaries or the mac os binaries or the windows binaries right so we are going to select windows from here and then we are going to select the exe option here so just select the link which is in front of the installer option here so click on this link here so just wait for the download to complete and once this exe file is downloaded i'm going to click on this exe file and let me minimize my browser so first of all you will see this kind of window which says do you want to allow this app to make changes on your device i trust this app so i will click on yes and now i can see the java jdk installer has been started on my windows 11 operating system so here you just need to click on the next button and this will be the default location where java will be installed on your windows 11 operating system just remember this location so by default it's installed in c then program files then it's going to create a java directory in program files folder and then there will be a jdk 17 folder or the name of the folder will be the version of jdk you are installing right so if you want to change this path just click on change and then change the destination otherwise if you don't have the good reason to change this location just leave it as default and then click on next which is going to start the installation of java on your windows 11 operating system so at this point you just need to wait for this process to complete and in few seconds you can see the java jdk has been installed on my windows 11 operating system so i'm going to close this window that means java is installed on my windows 11 operating system but still i have to do few things first of all i'm going to just go to the location where java is installed so just open your folder explorer and then go to the c directory and then i'm going to go to the program files where java folder is created and then in my case jdk 17.0.1 is created in your case this folder name version can be different so just go to this folder right now in order to set the environment variable for java what you need to do you can just click on the search icon once again and then just type edit and here which is going to show you this result which is edit environment variable for your account and it's going to open this kind of window you can also open this edit environment variable using control panel so you can search for control panel and then just view by category here and then click on system and security then click on system and then once the system window opens you can click on advanced system settings and then click on environment variables which is also going to show you the same window right so you can choose any method to open this environment variable window and once this is open you need to click on the path environment variable under system variables and then click on edit and here you need to add the path to your jdk folder binaries so go to the folder where we have installed java until a jdk folder and then click on bin folder so we need to go inside the bin folder inside this jdk folder and then copy the path right so until bin and then copy this path from here go to the environment variable window once again and then you can double click here or you can click on new which is also going to show you this option and then just paste this path until bin and then press enter which is going to add this path to your environment variables click on ok so your java environment variable is set now some application also needs the java home environment variable on your windows operating system to run them so let me show you how you can set the java home environment variable also so you can go at the top under user variable section and then click on new here and then the variable name you need to provide here is java underscore home everything is capital just write whatever i have written here everything in capital and the variable value will be the folder which we have opened which is the jdk folder so don't go inside the bin folder in this case just copy the path until jdk folder you don't need to go inside the bin folder in this case okay and then just paste this path under variable values okay so you can see there is no bin folder added here only the path until the jdk folder click on ok and then click on ok and then click on ok which is going to set the environment variable for java on your windows 11 operating system now once you have installed java and set the environment variables you can use java on command line so you can just open the command prompt by typing cmd once again and then i can type java space hyphen version here and it's going to show me the version of java so you can see java version 17.0.1 is installed on my windows 11 operating system now if you want to compile a java file you can use the java c command so you can just write java c space hyphen version here and then press enter and you can see the java c version is also same so as i said you can use java c to compile a java file on your windows 11 operating system so first of all just open your favorite browser and search for eclipse ide and the first link which will appear here will be from eclipse.org forward slash ide so i'm going to click on this link and once you are inside this eclipse.org website you will be able to see this kind of web page here right so you can see uh what eclipse ide can do and on the top i can see this download button here so i'm going to click on the download button and when i click on the download button i will be redirected to the downloads page here and here i can see get eclipse ide download button on the top it also says eclipse installer now includes the gre for mac os windows and linux so just click on the download button here and then it's going to redirect you to uh webpage where you can click on the download button which is going to start the download of this eclipse ide so i'm going to wait for the download to complete so once this executable file is downloaded i'm going to just click on this executable file and let me minimize my browser and now i can see that this installer is starting and now you can see this eclipse installer has been started so let me just uh maximize it so you can see this so when eclipse installer starts you need to select for which purpose you want to uh use eclipse ide so the most famous and popular is eclipse ide for java developers but if you want to use eclipse ide for c plus plus or php or for other programming languages you can choose that from this list right i'm going to install eclipse ide for java so i'm going to choose the first option which is eclipse ide for java developers and when you click on this you will be able to see this window now when you come to the next window you will see this section here so because i have already installed java jdk on my windows 11 operating system eclipse is going to recognize that and it's going to show you the path to the jdk folder if it's not present it's going to show you all these links here so you can choose the top link from this list so i'm going to choose the jdk folder which i already have installed if you don't know how to install java jdk on your windows 11 operating system i have already created a video on that so i'm going to put the link in the description so you can follow that video this is the installation folder for eclipse so if you don't have the good reason to change it just leave it as default and then click on install and first of all you will see this license terms and agreement page so if you want you can read this page and then click on accept now which is going to start the installation of eclipse ide so at this point you just need to wait for some time until eclipse downloads all the packages and install them on your windows 11 operating system and when eclipse ide is successfully installed on your windows 11 operating system you will be able to see uh this launch button here also you will be able to see that eclipse installer has created this desktop shortcut for us so from the next time you can click on this desktop shortcut in order to launch your eclipse ide so let me click on the launch button which is going to launch eclipse on my windows 11 operating system and for the first time when you start eclipse ide it's going to ask you to provide the workspace folder so this will be the folder where all your eclipse project will be saved so if you don't have the good reason to change this location just leave it as default you can also check this checkbox which says use this as the default and do not ask again and then click on launch which is going to launch the eclipse ide and once eclipse ide is launched it's going to look like this right so you have the tutorials and overview and samples here you can click on create a new project which is going to help you to create a new project and if you want to just minimize this welcome window you can click on the minimize button here which is going to minimize this welcome window and it's going to show you the eclipse ide overview right also i can see the donate tab here i can close this and now it looks like this right so in order to create a new project you can either click on create a new java project or create a new project option or you can click on the file and then click on new option and then select from here so i'm going to select java project from here and first of all you need to provide the name to your java project so i'm going to name my project as hello for now and you can see this will be the default location where your project will be saved so in the next section you can select the jre for your project right so by default eclipse is going to suggest you to use the execution environment jre which is this one if you already have installed java jdk separately on your windows 11 operating system you can also choose this option which says use the project specific jre and from here you can select the jdk version for your project so i'm going to choose that so if you don't see any jdk version here you can just leave it as default otherwise you can select the jdk version from here and under project layout i'm going to leave it as default and then click on next button so on the next window you will see this kind of interface i will leave everything as default because this is just a sample project and then i'm going to click on the finish button and here it's going to ask me to provide the module name i will leave it as default and then click on generate comments also and then click on create button which is going to create this project for me so now you can see this project is created and from here i'm going to just uh remove this java file because i want to create my own java class so under source i'm going to right click once again and then click on new and then i'm going to choose this option which says class and then i can name my class so let's uh name our class as hello once again and then the modifier will be public so just leave it as a default and here which method stubs would you like to create i'm going to select this option which says public static void main so it's going to create the public static void main method which is the main method for java for us and then click on finish and you can see this class is created and this public static void mean method is created right now if you uh want to change the font size because this font size is really small and i think you might not be able to see the code which i am writing so for changing the font and other settings you can click on window and then click on preferences and then click on general and then select appearance and you can expand this and then click on color and fonts and from here you can choose java and then click on java edit the text font right and then click on edit which is going to allow you to change the font and the font size so let me make it little bit bigger let me choose 18 or 16 from here and then click on ok and then click on apply and then click on apply and close you can see the font size has been increased and then i can just write a very simple code for printing hello world so from here i can just type system dot out dot print ln so this is the method which you use to print uh some text inside the double quotes i can just write hello world here and once you are done you can save this file by clicking ctrl s and then if you want to run this project you have these buttons here so there is this debug hello dot java file there is this run hello.java file you also have other tools for example run last tool so from here i'm going to press this button which says run hello.java file it's going to run your code so first of all it's going to compile your code and then it's going to run your code here so you can see hello world is printed that means eclipse ide is working fine on your windows 11 operating system and then you can start using eclipse ide on
Info
Channel: ProgrammingKnowledge2
Views: 30,346
Rating: undefined out of 5
Keywords: Install Eclipse, Eclipse, Eclipse IDE, Java Development Kit, JDK, Windows 11, JDK on Windows 11, Eclipse IDE on Windows 11, How to Install Eclipse, How to, Eclipse Photon, Eclipse Oxygen, javaprogramming, javabasicsforbeginners, javaprogrammingtutorial, javatutorialforbeginners, Integrated development environment, Java Development Tools, Open source, Eclipse Photon IDE
Id: 49dsAE8iv5M
Channel Id: undefined
Length: 17min 5sec (1025 seconds)
Published: Sun Feb 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.