Create Java apps using SQL Server on Windows
In this section, you will get SQL Server 2017 running on Windows. After that you will install the necessary dependencies to create Java apps with SQL Server.
Step 1.1 Install SQL Server
- If you don’t have SQL Server 2017 Developer (or above) installed, click here to download the SQL Server exe.
- Run it to start the SQL installer.
- Click Basic in Select an installation type.
- Click Accept after you have read the license terms.
- (Optional) if you need to, you can choose a custom installation location for SQL Server.
- Click Install to proceed with the installation.
You now have SQL Server installed and running locally on your Windows computer! Check out the next section to continue installing prerequisites.
Step 1.2 Install Java
If you already have Java installed on your machine, skip the next three steps.
Install the Java Development Kit (JDK) by following the steps below.
- Click “Accept License Agreement” on the JDK download page
- Download the appropriate JDK installer for Windows based on your operating system requirements (32 or 64-bit)
- Run the installer and follow the installation prompts to complete the JDK installation
Add the JDK to your PATH environment variable
- Press start
- Search for “Advanced System Settings”
- Click on the “Environment Variables” button
- Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value for the PATH variable: C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0\bin
1.3 Install Maven
Maven can be used to help manage dependencies, build, test and run your Java project. Follow the instructions below to install Maven.
- Download the Maven binary
- Unzip the installer to a file location on your computer
Add the Maven bin directory to your PATH environment variable and add the JRE to the JAVA_HOME environment variable
- Press start
- Search for “Advanced System Settings”
- Click on the “Environment Variables” button
- Add the location of the bin folder of the Maven installation to the PATH variable
- Create a new System Variable for “JAVA_HOME” and point it to the JDK folder (ex. C:\Program Files\Java\jdk1.8.0_102)
- Check that Maven was installed properly by running the following command.
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: C:\apache-maven-3.3.9\bin\..
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_102
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
You have successfully installed Java and Maven on Windows. You now have everything you need to start writing your Java apps with SQL Server!
Have Questions?
Happy to help! You can find us on GitHub, MSDN Forums, and StackOverflow. We also monitor the #SQLServerDev hashtag on Twitter.