creating executable jar, class not found on dependancy


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: creating executable jar, class not found on dependancy

  1. #1
    Join Date
    Mar 2005
    Posts
    19

    creating executable jar, class not found on dependancy

    Hi,

    I have my application ready for it's first release but I'm experiencing grief trying to get it to include another jar file it depends on.

    The application uses the mysql connector so I need to include the mysql.xxx.jar

    I'm using the Eclipse IDE. When I run the program from withing the IDE everything works, but when I export it to a jar the UI does come up but as soon as I do something that requires the database connection I get a ClassNotFoundException for the mysql driver.

    How do I create the executable jar and include the mysql connector?

    Thanks
    GT

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    I'm not familiar w. eclipse, but I isn't there a wisard/setup for the jar export where
    you can specify the required jars/libraries, or do you have to manually edit
    the manifest file ?
    Last edited by sjalle; 04-04-2005 at 03:56 AM.
    eschew obfuscation

  3. #3
    Join Date
    Mar 2005
    Posts
    19
    It has an export wizard especially for it, that unfortunately doesn't make it that obvious how to include it. I've specified libraries to include in the projects properties, which one would expect would be picked up in the export process. I do have the option to give it a previously created manifest file.

    I've never seen a manifest file before though.

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Well, as I run the wizard in JBuilder I have the options to include more or less of the
    classes I use, sometimes it's easier to just specify all classes, but that results
    in quite large jars. I can't imagine that a jar builder wizard for Exclipse would be
    so much more different.

    Nevertheless, - the required libraries etc. for the project does not automatically
    equal the requirements of the executable jar.

  5. #5
    Join Date
    Mar 2005
    Posts
    19
    I think it's unbelievable -

    I have a lib dir in my project where I've put the jar and when I export, it lets me tick the lib folder but doesn't display the file - what the?

    I'm sure they had a good reason to put the feature somewhere else, assuming they have, but I have to say, while I'm *****ing, it's not easy to find where they put it.

  6. #6
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Maybe the best is to leave the Eclipse wonderland and lookup the sun java doc
    on jars and manifests and just do a jar build from the dos prompt.
    eschew obfuscation

  7. #7
    Join Date
    Mar 2005
    Posts
    19
    Ok, I'm trying to make this jar from the command line now.
    I can create the executable jar and it all works fine but... only when the external jar is on the classpath somewhere.

    So, just to reiterate, I'm trying to include the external jar within my jar so there's no installation process. Is there something I can do to my manifest to tell it to use the external.jar from inside my new jar?

    Here's my manifest
    Code:
    Manifest-Version: 1.2
    Main-Class: dbImportX.Core
    Created-By: GT
    I compile it from the command line using
    Code:
    jar cvfm dbi.jar mymanifest.txt dbImportX

  8. #8
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    what you want to achieve is quite possible, so I think you should look up the sun javadoc on the web for manifests.

    But check this out, they claim to hand out a free java2exe builder...

    http://forums.devx.com/showthread.ph...&highlight=fly

  9. #9
    Join Date
    Mar 2005
    Posts
    19
    thanks sjalle

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center