1

I try to run this java.jar file in centos 5 and i see this error. i installed java with

yum install java 

but i think jdbc is not installed coz when i type this command

yum install mysql-connector-java

i get No package mysql-connector-java available. Nothing to do

when i run this commandd to start jar file

java -jar "/home/httpd/5plus.net/httpdocs/test/server/ChatServer.jar"

i see this message

[root@google ~]# java -jar "/home/httpd/5plus.net/httpdocs/test/server/ChatServer.jar"


 -- Sat Apr 05 10:45:01 GMT 2014 ---   Start Main Server   ---
 -- Sat Apr 05 10:45:01 GMT 2014 ---   Can't register JDBC driver: org.gjt.mm.my        sql.Driver, Exception: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver    ---
 -- Sat Apr 05 10:45:01 GMT 2014 ---   Port 8090 Listen Start   ---
 -- Sat Apr 05 10:45:02 GMT 2014 ---   Client Connected: Ip = 208.54.35.217   -- -
 -- Sat Apr 05 10:45:03 GMT 2014 ---   InputData From 208.54.35.217 useridx: 0 D ata:  LOGIN$81   ---
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/plus?user=plus&password=plus123&characterEncoding=utf8
 -- Sat Apr 05 10:45:03 GMT 2014 ---   Can't create a new connection for jdbc:my sql://localhost/plus?user=plus&password=plus123&characterEncoding=utf8   ---
arlind
  • 165
  • 1
  • 3
  • 15
  • You need to pass classpath to JVM, this seems similar to your problem : http://stackoverflow.com/a/29138610/1121249 – rkosegi Dec 28 '15 at 19:15

1 Answers1

0

You need the driver for the JDBC. The driver you appear to be using is old. If you can, you should update it to the one found here: https://dev.mysql.com/downloads/connector/j/.

If you're doing this at the terminal, you're going to have to include the driver in the classpath. Using an IDE will make it easier. If you're using Eclipse, simply right-click your project, then select Build Path > Configure Build Path > Libraries > Add External Jars. Select the driver from your Downloads folder (or wherever you put it), and you're good to go.

TMBT
  • 1,183
  • 10
  • 17
  • in eclipse i added the jar file. i try in another vps centos 6 64bit im runing zpanel there and it works. when i try the same file in centos 5 32bit im runing kloxo here and i see this jdbc error – arlind Apr 05 '14 at 19:26