I have an eclipse Java project that allows connection to a database, given the url of the database and user credentials for connecting to that database. The project runs on eclipse and successfully connects to databases with the help of "ojdbc14.jar" and "mysql-connector-java-5.1.38-bin.jar" drivers.
In eclipse I have added these two drivers to my project by [right clicking in my project]->run configuration-> [add those .jar drivers to my "Classpath], so that when I run my Java project, the drivers are loaded and everything runs smoothly.
I am trying to create a jar file that includes these two drivers within the created .jar file, so that I can run through the command line my Java project the same way I'm running it on the eclipse console.
I have tried [right click project ->export -> jar-> select all files on my project-> choose main method. Etc] to create the jar file. I can open the generated jar through command prompt (Java -jar myjar.jar) and use the " main" method just like i do on eclipse but when it comes to load the driver the program stops because apparently I can't load the drivers (ojdb14.jar and mysql*.jar files).
How can I generate a *.jar file with those drivers included in it so that my program actually can find them when it is run? As of right now I have those drivers inside of a folder under the root of my project because I thought that that way they will be packed. But they can't be found when I run my.jar file in terminal.