Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-14-2008, 10:41 AM   PM User | #1
proffittcenter
New to the CF scene

 
Join Date: Sep 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
proffittcenter is an unknown quantity at this point
MySQL in Netbeans

I have a Java program developed in Netbeans which successfully connect to a MySQL database.
It should also run when I double click the buit jar file, but in this case gives an error:
java.lang.ClassNotFoundexception:com.mysql.Driver
I have gone over the step a number of times given in various tutorials but cannot find the cause. Any suggestions would be greatly appreciated.
proffittcenter is offline   Reply With Quote
Old 09-14-2008, 03:06 PM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
is the driver jar for mysql in the classpath? or have u included it inside the jar that you built and added the class-path attribute in the manifest file?
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Old 09-14-2008, 03:13 PM   PM User | #3
proffittcenter
New to the CF scene

 
Join Date: Sep 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
proffittcenter is an unknown quantity at this point
I have tried putting it in the classfile but it made no difference. It is included in the jar file.
'added the class-path attribute in the manifest file?' not sure what is needed here. I have never looked at the manifest file so will get back to you on this.
proffittcenter is offline   Reply With Quote
Old 09-14-2008, 03:43 PM   PM User | #4
proffittcenter
New to the CF scene

 
Join Date: Sep 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
proffittcenter is an unknown quantity at this point
From the manifest file, I have:
Class-Path: lib/swing-layout-1.0.3.jar lib/ostermillerutils_1_06_01.ja
r lib/napkinlaf-swingset2.jar lib/napkinlaf.jar lib/mysql-connector-j
ava-5.1.0-bin.jar lib/jcalendar-1.3.2.jar lib/looks-2.0.1.jar lib/utc
_jpos_common_101.jar lib/beansbinding-1.2.1.jar lib/comm.jar lib/jasp
erreports-2.0.2-applet.jar lib/jasperreports-2.0.2-javaflow.jar lib/j
asperreports-2.0.2.jar
or more simply
lib/mysql-connector-java-5.1.0-bin.jar
This seems to be wrong version so will try changing it to the correct one.
Change made no difference.
Manifest seems to contain things that have since been removed and connector was an old version. Is it possible to re-generate the manifest?
proffittcenter is offline   Reply With Quote
Old 09-14-2008, 04:20 PM   PM User | #5
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
Quote:
Originally Posted by proffittcenter View Post
This seems to be wrong version so will try changing it to the correct one.
Change made no difference.
Manifest seems to contain things that have since been removed and connector was an old version. Is it possible to re-generate the manifest?
yes you can modify the manifest by simply creating the jar again with the correct manifest attributes. if you are using ant to build then you might have to update the manifest entries specified in your build.xml
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Users who have thanked shyam for this post:
proffittcenter (09-14-2008)
Old 09-14-2008, 04:25 PM   PM User | #6
proffittcenter
New to the CF scene

 
Join Date: Sep 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
proffittcenter is an unknown quantity at this point
Thanks for pointing me in the right direction. Never touched Ant - leave Netbeans to do all that sort of stuff. Having messed up my copy of the manifest, I copied an empty manifest from another program and then on build it re-generated with correct inclusions and all works now. Thanks again, this has delayed me for more time than I would like to admit.
proffittcenter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:07 PM.


Advertisement
Log in to turn off these ads.