This site requires JavaScript, please enable it in your browser!
Greenfoot back
CooliMC
CooliMC wrote ...

2014/6/12

Add loaded Library to shared jar. file

CooliMC CooliMC

2014/6/12

#
Hey Community, I have written a Login where the User Name and Password where saved in SQL Datebase , that works fine. To start connection i loaded a .jar called mysql-connector-java-5.1.21-bin.jar ,but the problem is if i export the Project to a jar File I cant intelize the connection because this library (i think) is not loaded in the jar file because it is only a /userlib in Greenfoot .
CooliMC CooliMC

2014/6/12

#
could someone pls help me
davmac davmac

2014/6/13

#
One possibility is to extract the contents of the library into your scenario folder, before you export the scenario. You will need to load the Mysql connector class manually using:
 Class.forName("com.mysql.jdbc.Driver") ;
CooliMC CooliMC

2014/6/13

#
ok i tried and in the scenario where should i add this line Class.forName("com.mysql.jdbc.Driver"); ?? in constructor or before the connection methode ??
CooliMC CooliMC

2014/6/13

#
And where to copy the library in the secanrio folder ???
davmac davmac

2014/6/13

#
where should i add this line
You just need to execute that line before you try to open a database connection.
And where to copy the library in the secanrio folder ???
Extract, not copy. Directly into the scenario folder. A jar file is really a zip file, so you can extract the contents with winzip for example.
CooliMC CooliMC

2014/6/13

#
Ok i extracted it and thx for the Line but i recognized that i don't need the line, i don't know why i don't need it but it works without. Thanks to you davmac !!!
You need to login to post a reply.