How to load JDBC Driver and JavaFX SDK on Eclipse IDE

Anderies
3 min readJan 9, 2023

How to import JDBC Driver and import JavaFX SDK

download the file JavaFX SDK and MySQL Connector

1. Importing MySQL JDBC Driver

Here’s the step to load MySQL Java Database

  1. First download mysql-connector-j
  2. Configure your project by right click on the project name and choose Build Path -> Configure Build Path

3. Then choose Modulepath with left click, add External JAR

4. after following three-step above mysql-connector-jar will be added to your project, It’s Done now you can code using JDBC API with import java.sql.*;

What if you want to add JavaFX and MySQL Driver together, the steps are the same with MySQL connector however JavaFX needs to create a user library first

2. Importing both Java FX and MySQL Driver

Here’s the step to create user library

  1. first traverse to window (main tab IDE) > preferences > search java > build path > user libraries (see the figure below)

2. then create a new user library by clicking new > input the name you want for the library > add external JAR > traverse to your JavaFX SDK (for my class you can see the link at discord I provided)

3. Load the library in java fx by clicking every file in lib (see the figure below)

4. then you can follow the same step above to load this user library you created with configure build path > left click module path > click add library > choose user library then next > check the box you for the library you created > finish (see the build path below to make sure you are correctly importing the library)

4. make a module-info.java to manage the two libraries imported with the following code :

module LearningS11 {
requires javafx.controls;
requires javafx.base;
requires javafx.graphics;
requires javafx.fxml;
// requires jdbc
requires java.sql;

// this is change able base on the name of your packages
opens applicationtwo to javafx.graphicsm, javafx.fxml;
opens application to javafx.graphics, javafx.fxml;
}

This post is made with the purpose to share my knowledge and looking for room for improvement, want to be criticized, so if you have your own thought or ideas don’t hesitate to share in the comment below!

And as usual, if you liked this article, hit that clap button below see you on the next post👏

--

--