filmov
tv
How To Get Started with Java Development using VS Code on Windows (2021)

Показать описание
A quick tutorial on how to get started with Java development on Windows using Visual Studio Code. I go through all the installation and setup steps to get you ready to work on your Java projects.
If you don't already have VSCode installed, you can save yourself a lot of time by downloading the Coding Pack for Java, which contains Visual Studio Code, the Java JDK, and all the essential Java extensions for VSCode. You can find this in the link above.
If you do already have VSCode installed, that's not a problem either. The first step is to go to your extensions and find the "Java Extension Pack", and install that. Next you need to install the "Java Development Kit" if you don't already have it, which you probably don't if you haven't installed Java before.
There are two broad types of Java installation you'll hear about. There's the JRE, or "Java Runtime Environment", which allows you to run Java applications on your computer or device. And then there's the JDK, which stands for "Java Development Kit", which is what you need if you want to develop Java applications. If you install the JDK, that will include the "Java Runtime Environment", so you don't need to install both.
So we can install the JDK from VSCode now that we have the Java extensions. Open the Command Palette (either View, Command Palette, or Ctrl+Shift+P) and search for "Java: Configure Java Runtime". Now there are also different JDK implementations to choose from. I recommend you install the "AdoptOpenJDK" because this option is free and open source. If you use the Oracle JDK, you'll need to purchase a commercial license if you ever end up developing business software with it. So for most of you, just go ahead and install the latest stable OpenJDK version. If you need a specific JDK, you can of course download that JDK from its website and install it instead.
Alright, now we've got everything installed, and we just need to let VSCode know where the JDK is located. The path to it. There are two ways to do this. I recommend you set the JAVA_HOME system environment variable. This way anything you install on your computer, that wants to know where the JDK is, can get it from this value. So let me show you how to do that.
Open "File Explorer" and right-click on "This PC", or it might be "My Computer" on older versions of Windows, and select "Properties". Then in here click "Advanced system settings", and you should see a button that says "Environment Variables...". Click that, and create a "New..." system variable, either for yourself or for everyone on your computer. We're going to set the variable name to JAVA_HOME, and the value to the folder where the JDK is installed. In my case that's C:\Program Files\Java\jdk1.6.0_02.
In case I've lost you, you can see these same steps from "Java: Getting Started" in the Command Palette. You can also create a new project, instead of opening a new folder manually, by running "Java: Create Java Project", again in the Command Palette. And this will create a little more structure for you, in your project.
#Java #VSCode #Programming
If you don't already have VSCode installed, you can save yourself a lot of time by downloading the Coding Pack for Java, which contains Visual Studio Code, the Java JDK, and all the essential Java extensions for VSCode. You can find this in the link above.
If you do already have VSCode installed, that's not a problem either. The first step is to go to your extensions and find the "Java Extension Pack", and install that. Next you need to install the "Java Development Kit" if you don't already have it, which you probably don't if you haven't installed Java before.
There are two broad types of Java installation you'll hear about. There's the JRE, or "Java Runtime Environment", which allows you to run Java applications on your computer or device. And then there's the JDK, which stands for "Java Development Kit", which is what you need if you want to develop Java applications. If you install the JDK, that will include the "Java Runtime Environment", so you don't need to install both.
So we can install the JDK from VSCode now that we have the Java extensions. Open the Command Palette (either View, Command Palette, or Ctrl+Shift+P) and search for "Java: Configure Java Runtime". Now there are also different JDK implementations to choose from. I recommend you install the "AdoptOpenJDK" because this option is free and open source. If you use the Oracle JDK, you'll need to purchase a commercial license if you ever end up developing business software with it. So for most of you, just go ahead and install the latest stable OpenJDK version. If you need a specific JDK, you can of course download that JDK from its website and install it instead.
Alright, now we've got everything installed, and we just need to let VSCode know where the JDK is located. The path to it. There are two ways to do this. I recommend you set the JAVA_HOME system environment variable. This way anything you install on your computer, that wants to know where the JDK is, can get it from this value. So let me show you how to do that.
Open "File Explorer" and right-click on "This PC", or it might be "My Computer" on older versions of Windows, and select "Properties". Then in here click "Advanced system settings", and you should see a button that says "Environment Variables...". Click that, and create a "New..." system variable, either for yourself or for everyone on your computer. We're going to set the variable name to JAVA_HOME, and the value to the folder where the JDK is installed. In my case that's C:\Program Files\Java\jdk1.6.0_02.
In case I've lost you, you can see these same steps from "Java: Getting Started" in the Command Palette. You can also create a new project, instead of opening a new folder manually, by running "Java: Create Java Project", again in the Command Palette. And this will create a little more structure for you, in your project.
#Java #VSCode #Programming
Комментарии