Download and Install
Complete the following steps to install the Java driver and its dependencies in your development environment.
Install the driver dependencies
Before you begin this tutorial, ensure that you install the following dependencies:
JDK version 8 or later
Integrated development environment (IDE), such as IntelliJ IDEA or Eclipse
Note
This tutorial shows how to install the Java driver by using Maven or Gradle in an IDE. If you do not use an IDE, visit Building Maven or Creating New Gradle Builds to learn how to set up your project.
Install the Java driver
In your IDE, create a new Maven or Gradle
project. If you use Maven, add the following code to your pom.xml
dependencies list:
<dependencies> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver-sync</artifactId> <version>5.3.0</version> </dependency> </dependencies>
If you use Gradle, add the following code to your build.gradle
dependencies list:
dependencies { implementation 'org.mongodb:mongodb-driver-sync:5.3.0' }
After you configure your dependencies, ensure they are available to your project by running your dependency manager and refreshing the project in your IDE.
After you complete these steps, you have a new project and the driver dependencies installed.
Note
If you run into issues on this step, ask for help in the MongoDB Community Forums or submit feedback by using the Rate this page tab on the right or bottom right side of this page.