Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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?

  • #5
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    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

  • Users who have thanked shyam for this post:

    proffittcenter (09-14-2008)

  • #6
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •