0

I have a Java script that functions correctly in Eclipse, but when I export it as an executable JAR and try to run it from the Command Prompt I get the following error:

java.sql.SQLException: No suitable driver found for 
jdbc:sqlserver://[servername]:1433;databaseName=[databasename];user=[username]_sync;password=[password];
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at SFChecker_pack.SFChecker3.sql(SFChecker3.java:405)
    at SFChecker_pack.SFChecker3.main(SFChecker3.java:137)

In Eclipse my Build Path incorporates mssql-jdbc-7.2.2.jre11.jar

What do I need to do to get this working from Command Prompt?

David Martin
  • 95
  • 1
  • 2
  • 9
  • 1
    You need to add all dependencies to classpath when running from command line – Ivan Aug 29 '19 at 18:06
  • 1
    Try generating a standalone [uber jar](https://stackoverflow.com/questions/11947037/what-is-an-uber-jar) so that it contains all the dependencies necessary inside. Also, the question would mean much if you could share your command for generating that runnable jar i.e. Maven command etc. – vahdet Aug 29 '19 at 18:09

0 Answers0