0

I created a jar file from netbeans of my java application which is displaying mysql records. I am trying to run it on another computer which doesnt have netbeans but rather java SE. I fixed a major minor version issue by installing a latest java SE version. It is now running the jar file by now the next issue is it is giving me the java.lang.classnotfoundexception: con.mysql.jdbc.Driver

I tried to copy the mysql-connector-java-5.0.8-bin into second computer as well, but no luck.

Actually I need a solution where I just copy the jar file and able to run it as a server. I want to install it on multiple computers on the site, which might not allow me to install netbeans from internet.

  • it seems like your jar is not packed with all dependencies. Try to check here [http://stackoverflow.com/questions/11033603/how-to-create-a-jar-with-external-libraries-included-in-eclipse] – Solano Jan 16 '15 at 15:42
  • Actually you need to install mysql into it as well because it is searching for sql connection i guess... – squiroid Jan 16 '15 at 15:46
  • I have the same database on both computers issue is the with dependencies, though I created the jar file by checking including all the packages, I think I need to add the mysql-connector-java file to some path. In netbeans we add this file to project, but i am not sure where to add this file when we dont have netbeans – user3909713 Jan 16 '15 at 16:03
  • You need to add the sql driver jar to your classpath when running your program. Can you share how you are running the program? – Byron Jan 16 '15 at 16:10
  • I am running it from cmd java -jar – user3909713 Jan 16 '15 at 16:18
  • command prompt using the jdk and jre – user3909713 Jan 16 '15 at 16:29
  • mysql is a third-party dependency for your project. You must either include it in the jar you send to the remote host or ensure that the mysql jar is in the classpath on the remote host. – DwB Jan 16 '15 at 17:18

0 Answers0