# Tutorial: Visual Studio Code and Java

An integrated development environment (IDE) makes writing code easy.  [Visual Studio Code](https://code.visualstudio.com/)  is an IDE that works well with a variety of programming languages, including Java ☕. This tutorial describes how to set up Visual Studio Code with Java, so you can create Java programs with ease.

### Step 1: Install Visual Studio Code

1. Download the [Visual Studio Code](https://code.visualstudio.com/Download) installation program for your operating system.
1. Double-click the installation program to run it.
1. Accept all defaults during the installation process.

### Step 2: Install Java

This tutorial installs OpenJDK, the free and open-source version of Java.

1. Download the [OpenJDK](https://adoptium.net/?variant=openjdk11) installation program for your operating system.
1. Double-click the installation program to run it.
1. Accept all defaults during the installation process.

### Step 3: Creating a Java Project

1. Start Visual Studio Code:

  ![vs1.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635534494541/38i-4LmpV.png)

1. Click the extensions icon, circled in red:

  ![vs2.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635534758267/LIu3gQzlRm.png)

1. There are extensions that enhance Visual Studio Code for Java program development. Enter *Extension Pack for Java* in the text box to find the extension pack, then click the *Install* button to install the extension:

![vs3.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635538568235/eMl8uUjKW.png)

1. Click the files icon in the top-left, then click the *Create Java Project* button in the bottom-left:

  ![vs5.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635535151494/PHBk1B_MD.png)

1. Click *No build tools* to create a simple Java project in Visual Studio Code:

  ![vs6.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635535257002/V2eZOC8MH.png)

1. Select a folder location for your Java project. Select *Desktop*, then click the *Select the project location* button:

  ![vs7.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635535365870/D9Dws18hQ.png)

1. In the text box, type a project name, for example: *myjavaproject*. Then press the *Enter* key.

  ![vs8.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635535522427/AO3tR0SV2.png)

1. If prompted to trust the authors, click the checkbox to trust the authors, then click the *Yes* button to trust the authors:

  ![vs9.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635535732959/u3iWfePZ9.png)

1. If the *Java Help Center* window appears, click the `x` button to dismiss it. In the left window pane, expand *MYJAVAPROJECT > src* and click *App.java* to show the program in the editor window. App.java is a sample program that Visual Studio Code provides when you create a new Java project:

  ![vs10.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635535914987/vp9-elPzy.png)

1. After a few seconds, you will see *Run* and *Debug* links above the `main()` method declaration in the editor window. Click the *Run* button to run the Java program:

  ![vs11.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635536105021/XW2U55QSok.png)

1. Note the output of the program in the terminal window below the editor window:

  ![vs15.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635536417472/t78kOLk40.png)

1. To create a new Java program in the project, right-click the *src* folder and click *New File*. Then type a program filename, e.g., `HelloWorld.java` and press the *Enter* key. Now edit your new Java program in the editor window.

  ![v16.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1635536684635/DRmFclOhl.png)

🏆 **Congratulations!**

You are now ready to develop Java programs using Visual Studio Code. This IDE has advanced features such as inline documentation, auto-complete, syntax checking, a debugger, and more. Java program development will be much easier now!

Thanks for reading. 😃

*Follow me on Twitter [`@realEdwinTorres`](https://twitter.com/realEdwinTorres) for more programming tips and help.*


