If you want to create a new Java Project in Visual Studio Code using the Gradle build tool, you are in the correct place.

Java projects can be created in many ways

  • Using the command line tool
  • Using Different IDE (Integrated Development Environment) like
    • Eclipse
    • IntelliJ IDEA
    • Visual Studio Code
    • Net Beans

Prerequisites

Install Dependent Plugins in VS Code for Java Development

Open your Visual Studio Code and then we will install the plugins

click on the Extensions Tab in VS Code. Then you can search for the extensions.

Extension Installation: Extension Pack for Java

Search for Java. This will list down the Extension Pack for Java Extension. Click on the Install button for the extension Installation.

Extension Installation: Gradle For Java

Search for gradle and then click on install for the Gradle for Java Extension

Create New Java Project

open the command palette of Visual Studio code

Click on View Menu and then click Command Palette

Then search for Java and then click on Create Java Project

Then it will ask you to select the Build Tool. Click on Gradle

Then it will ask you to select the folder where you want to create the Project.

  • Create a new folder first in the location where you want to create the Java Project
  • Keep the Folder name same as the Project name, which you will be creating in the next steps
  • we have created a folder named hello-world

Finally, it will ask you to select the build script DSL. You need to select Groovy

The final step will be to input your project name.

we are having the project name hello-world

Once the above steps are completed then gradle will run in the background and create your Java Project

Open Java Project using Visual Studio Code

You need to select File and then Open Folder option inside it, Finally you need to select the path where the Java project is created in the above steps and open that folder.

The Main file will be located inside app => src => main => java

Leave a Reply

Your email address will not be published. Required fields are marked *