How to Install & Run Java in Visual Studio Code (2020)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey my name is stella and today i'm going to be teaching you how to install and run java in visual city code by the end of this video i hope that you'll have a better understanding of what visual studio code is what it can offer and also be able to run your first java program on it so let's get started what is visual studio code visual studio code is a free source code editor that was made by microsoft in 2015. i like to view visual studio code as a combination between text editors like vim and also integrated development environments like pycharm so not only can you modify and change text files in vs code you can also run it with ide functions like a debugger visual studio code is compatible with windows mac os and as well as linux and you can run many different programming languages on it such as java python html c-sharp and so many more now let me show you a few things that visual studio code offers visual studio code provides something called intellisense where it can provide you with smart completions based on function definitions variable types and as well as important modules it has git commands built in so you can push pull and also make commits right in visual studio code also you can debug your code line by line and there are many extensions that you can download to customize your workspace i recommend getting the material icon theme because it can help you organize your files based on the programming languages and gives you really cute icons like so extensions are also the place where you can download your programming languages and the packages you need in order to run them so let's download java in visual studio code i googled java visual studio code and i clicked on the first link then we're taken to an overview page of what java and visual studio code is i clicked on the java getting started tutorial button next we're taking to page with different links if you're a windows user i recommend you using this installer and if you're a mac user i recommend using this installer regardless if you have visual studio code or not installer will automatically detect that and only download the things you need in order to run java from trusted online sources however if you are a linux user you'll need to download three things the first thing is vs code itself next you need to download a java extension pack so you would just click on this link right here lastly you need a java development kit so you just need to go down and then i recommend the oracle one because that's the one i'm using all you have to do is click on that link and then it'll take you to the page where you can download the jdk file all right after you're done downloading now it's time for you to run your first java program so let's open our newly installed visual studio code when we open up this application we'll be taken to a welcome window and this window will tell us the different tools and languages we have already downloaded as well we're able to make the changes to the color theme to make our editor look the way we want it to look and down here's a little help box just for future reference in order to make our java file we need to open a folder where we want to store it in so file open and i would like to store my java file in this installed java folder so let's open that up next visual studio code will open a whole new window with that folder opened install java awesome so we will click on this icon right here in order to make our first java file i will name it install java.java and there you go here's your first java file in order to run this file we need to put a little bit of code in it so let's do a public class install java next we need a main method so i just need to type in main and intellisense will do the rest for me lastly i would like to print out hello world and we save it by if you're a mac user i use command s if you're windows user control s there you go here's your first java file that's saved but we have one more thing we need to do in order to run our java program we need to make sure that our jdk is actually being recognized by visual studio code so we will go down to the bottom left corner and click on the gear and click settings next we will click on applications go down into proxy and scroll until we see edit in settings.json after we clicked on that we will be taken to this page right here and all we need to do is focus on this line which is the java.homeline for me it's in line eight but for you depending on how many different programming languages you have it may be different you can see here that our java.home references our jdk folder and this is what you need to make sure you need to make sure that your jdk path is actually put here so that our visual studio code can find it in that folder now you are ready to run your first ever java program let's close settings.json and settings and then we will go down to our terminal in order to run our java program we need to compile it first so java c install java.java and then once it's compiled we should see a dot class file right here perfect last thing we need to do is put java install java and there we go hello world congratulations you've just run your first java program in visual studio code what we did was we created a single java file however what if you wanted to create a java project with multiple files in it this is what you would do you would go up to view and you click command palette or if you are a mac user shift command p and you would either type in create java project or click on it if it is shown next you will decide if you want to use any build tools or not for the instance of our video we'll go with no build tools we will then decide what folder we would like to save our java project in i'll be using the same folder so let's select this location and then i will name my java project test example you can see to the left in our install java folder our test example java project is shown vs code also opens up a new window with just your java project open so let's expand that and you can see here there is a folder for your library and your folder for your source code if we click on source code we can see that vs code generates a default java file called app.java and you can definitely change the name of this file you can also add more java files in it but this is just a basic of how to create your own java project thank you so much for watching my video i hope that you were able to follow along and learn some interesting new things if you like this video please make sure to give it a big thumbs up i make videos like this every single week so if you like what you see please subscribe to my channel also if you have any questions comments or even requests for future tutorials please leave them down in the comment box below other than that thank you again for watching my youtube video and i'll see you next week
Info
Channel: Stella Li
Views: 15,626
Rating: 4.8857141 out of 5
Keywords:
Id: PhK98HN7W2c
Channel Id: undefined
Length: 7min 17sec (437 seconds)
Published: Tue Sep 15 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.