for to execute the swing application where i have to put mysql-connect

swing aplication execution which access database

Posted 06 December 2008 - 05:16 AM

]for to execute the swing application where i have to put mysql-connector-java-5.1.5-bin.jar file. i successfully compiled the program but while i started execution it is showing that class not found exception com.mysql.jdbc.Driver. from that we can understand that mysql-connector-java-5.1.5-bin.jar file is not recognised.

Re: swing aplication execution which access database

Posted 07 December 2008 - 09:22 PM

g00se, on 6 Dec, 2008 - 01:46 PM, said:

You need to ensure that driver jar is in your classpath

hi friend thanks for your reply. and my problem is i set the classpath and compiled successfully and then only i am running. if CLASSPATH is not set then the program will not compile. so my program is successfully compiled means the driver jar file is in CLASS PATH. and my stand alone file which access database is working fine whic means jar file is in CLASSPATH.

THE PROBLEM IS FROM SWING APPLICATION ONLY IT WONT WORKING. THAT IS MY PROBLEM. PLEASE HELP ME IN THIS REGARD.

Re: swing aplication execution which access database

Post the result of placing the following as the first line of your main method:

hi,

i didnt understand what you said, but i solved the problem by
placing the mysql-connector-java-5.1.5-bin.jar file in jre/lib/ext folder and
jre/lib folders.

and i f remove the mysql-connector-java-5.1.5-bin.jar file from these two folders it is not working. as it is jre environment it is identifying the jar file.
it is now workling fine and any application can run if we place our jar files what are they, here in the two folders of jre.

i dont understand, why swing application is not working if the jar file is in the CLASSPATH also.

Re: swing aplication execution which access database

i dont understand, why swing application is not working if the jar file is in the CLASSPATH also.

It ISN'T in the classpath. You've just put it there though, by putting the jar in the ext directory

hi,

what i said is that my swing application working fine if i placed the mysql-connector-java-5.1.5-bin.jar file in jre/lib and jre/lib/ext folders.

and if i remove mysql-connector-java-5.1.5-bin.jar file from these two folders my swing application is not running even if mysql-connector-java-5.1.5-bin.jar is in the CLASSPATH also.

the same thing repetead in my friends system also with this swing application.

my question is why it is not recognising the jar file which i placed in the CLASSPATH.

if CLASSPATH is not set properly then my other applications wont work which access database. but they are working fine from being as stand alone applications. the problem is it is not working from my other swing applications also. this is my problem.