I'm packaging my java program as a jar..it includes mysql-connector.jar..it runs fine when i run it in eclipse..now i need to distriute the jar file..I packaged the jar file and when I run it through command line using java -jar myprogram.jar, it throws ClassNotFoundException: com.mysql.jdbc.Driver
could anyone please tell me what is going wrong??

my manifest looks like this

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
    <classpathentry kind="lib" path="lib/mysql-connector-java-5.1.14-bin.jar"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

You just go on your program you want to build as .jar.
Go File>Export>Runnable Jar and then you have options how to pack it...
Find what you want and it will automaticly include jdbc.driver in your .jar package...

thanks it worked..that was the only option i had

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.