guys do you want to know how to set up vs code for creating and running Java program so this video is for you hey guys welcome back to my channel in today's video I'm going to show you how to run Java program in VSS code VSS code is one of the most popular ID I will be showing you how to download how to use it everything I'm going to show you so watch my video till end so guys let's begin so for running Java program you require jdk as well as you require uh vs code
ID so first of all I will be uh showing you what how to download VSS code so now guys for that what I'm doing I'm just starting my command prompt and I'm showing you that I'm not having any Java install on my PC so you can see I have just typed Java hyphen hyphen version and it is showing me Java is not recognized so guys I don't have Java install on my PC now let me go to browser and let me show you how to install Java so you can open any of your favorite browser
and just type jdk download and guys here you can see the official website oracle.com you have to click on Java download link and guys now here different operating system it is showing so you have to click on Windows because I'm using Windows so if you have any other operating system you can just change that so just select this Windows Tab and just scroll down and here we have different products available I'm going to take x64 MSI installer and we'll click on this link so guys you can see my download has been started it will not
take time you can see it's done so now to uh start um setup I need to click on this MSI and here I'm going to click on next button guys this is the installation location for Java just click on next button so Java is successfully installed done guys click on this close button so we have one prerequisite Java now we will be installing vs code okay so uh we have to set the path also now let me show you how to add a path to environmental variable okay so guys now I'm going to copy the
path of my Java jdk so I'm going to seeon program file see Java jdk bin and simply copy this path because we have to set this into environmental variable let me close this and here I'm searching EnV that is edit the environmental variable and and just start this and here guys you need to click on this environmental variable button so guys now here we will be creating a new variable javore home so for that click on this new button and type variable name as Java uncore home and here guys past the copied path but you
need to remove this slash bin it should be up to jtk and click on okay and now guys scroll down and here you will find one variable path variable now we need to edit so for that that click on edit button here click on new button and again paste the copied path guys and click on okay okay and one more time okay so guys path is set now we will be checking whether my Java is working or not so for that we are just starting command prom so in search type CMD and here just type
Java space hyphen hyphen version so boom guys you can see I'm not getting any error I'm getting my Java version over here so that mean your Java installation is successful web browser and then type vs code download here is the official website click on this link and guys here we have different operating system based on that you can download I'm just clicking on this windows and guys my download has been started and it is done it hardly takes a time so now let's click on this exe here I'm going to click on I accept the
agreement and then I'm going to click on this next button going to add what my vs code in my menu start menu so that is okay I'm going to click on next button if you don't want you can check mark that and this is if you want to create shortcut on desktop you can check and the next option is that when you right click uh and if you want open with VSS code you can check mark on this so I'm doing that and next button and guys here we need to click on install button so
installation will be started and guys here the install has been started we will wait okay guys my installation is done now it's showing me this uh screen so I'm just want to launch this vs code so I will check this and I will click on finish button so guys my vs code uh is started and this is the welcome screen for vs code here it's showing different themes available whatever themes you want to select you can select let me select uh dark team okay so you can select any one of them no problem let me
close this um welcome page I don't need this welcome page and now guys now the important step we are going to follow that is what extension so for running Java program you required few extension okay in vs code if you want to run anything any program you need to download extension so just go to this extension Tab and guys here you have to search for two extension okay the first extension is Java just type Java it will show you various op option select this option extension pack for Java so this is going to install six
extensions since it is a pack it is going to install six extension so here are the six extension it will install what uh test Runner mavin project manager language support for Java debugger all the six packs it will install so you can see uh I'm clicking on this install button and my installation has been started it is showing me installing since it will install six pack so it will take a while so we will wait for it okay guys so installation for a Java package done here my uh Java development is ready now I will
suggest you to install one more uh extension uh that is code Runner okay so uh let me close this and you can see here it has installed all this for my Java right language support project so total six uh has been installed so now let's in install another um extension so here type code Runner code Runner is one of the popular extension so it can be used for any programming language so code Runner you have to install this one okay run okay so this is the uh code Runner just click on install button so done
installation of code Runner is done so guys now uh let me show you how to create project so go to file menu and click on open folder over here and you can browse your folder wherever you want to save your program so I'm just taking my CS Corner folder and I'm just clicking on this select folder so just click on this select folder now guys here it's showing me do you trust the author of this folder yes I TR just click on this button and you can see under my Explorer it's showing me my folder
CS corner right so now you can create your file inside this just click on this new file button and give your file name Java file name so guys here you need to provide a Java file name so I'm giving Java file name as hello demo. Java and hit enter guys and you can see your Java file got created over here right now we will be writing code so let's start with a class so here we I'm writing class class hello demo curly bracket is generated now next I will write psvm and then select this and
you can see guys public static void Min which is nothing but entry point for Java program is generated now I want to print simple statement so I'm typing s out and again you can see system.out do print Ln is generated in this I'm just going to print a simple message so guys my code is done my program is ready now so I will run this program so to run this program and I'm going to select run code and boom guys I'm getting my output okay so this is done I got my output now one more
point I would like to show you because uh if you doing Java program definitely you may require user input so uh you can see the output is coming under this output tab right but we want output uh should come in terminal tab because for accepting user input terminal is required so now simply I'm just modifying my program and I'm creating one uh object of scanner so that I can accept input from user and then I'm asking user that enter some value and whatever value user is um entering I'm just storing that into a variable and
then guys I'm just trying to print that value okay this is my simple Java code and now what I'll do I'll run this program okay so if I'm running this program you can see again the output is coming in uh this output tab enter some value but guys here I'm not able to type okay I'm not able to type so U if you want to accept user input this Pro this way will not work so so we have to just change the output should come into terminal so we have to do some settings so guys
you can go to this setting tab which is given at the bottom left or you can go to file menu and you can select preferences option and settings and there guys you need to just search one option run in terminal and here guys you can see this check box run in terminal just select it okay that's all guys now I will run my program again and boom guys you can see now I'm getting my output in terminal and here it is asking me enter something so I'm entering something over here and then guys you can
see it has accepted the input and it is printing that mean it is accepting my user input so guys I have shown you everything like uh installation to how to accept user input in Java I hope guys by following my video you are able to successfully run your Java program in vs code so guys if my video has really helped you don't forget to click on like button and if you have any type of query you can put in comment box I will surely reply to your queries and guys uh I'm sharing lots of PDF
and notes freely on my telegram channel the link of my all social media I have given in description box you can follow me there also and guys if you are new to my Channel please subscribe to my channel and don't forget to press Bell icon to receive more videos from my channel thank you guys for watching my video till end I'll see you in my next video till that bye-bye and take care