Search code examples
javabukkit

How to install com.mysql.jdbc.Driver on debian to connect to database java


I was working on a plugin that saves data inside of the database, but I got an exception:

java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver

I know that this means that the driver is not found, but I don't know how to install it. I'm using a Debian VPS, and I was wondering how to install it. Thanks in advance!


Solution

  • If you use maven you can just add this to your pom.xml:

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.23</version>
        <scope>compile</scope>
    </dependency>