Issue
I am working on a project, my project should be connected with Database
, When I run it on NetBeans
it works perfectly, But when I am try to run the executable jar file i have an error like this,
"No suitable driver found for jdbc:mysql://localhost:3306/DENTAL"
please note that I added the mysql-connecter.jar
to libraries.
Thank you
Solution
Please use the following to generate jar file:
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>edu.learn.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-runnable-jar</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
then run mvn clean package
Answered By - Noman ali abbasi