participate


Java Programming - distributing the MySql driver inside a JAR - how to ?
<<   Back to Forum  |   Give us Feedback
This topic has 11 replies on 1 page.
FelipeGaucho
Posts:983
Registered: 5/25/01
distributing the MySql driver inside a JAR - how to ?   
Nov 23, 2005 9:51 AM

 
dear friends,

how can i distribute the driver of the MySql within my JAR ?
 
DrClap
Posts:38,739
Registered: 4/30/99
Re: distributing the MySql driver inside a JAR - how to ?   
Nov 23, 2005 9:54 AM (reply 1 of 11)  (In reply to original post )

 
You don't. You distribute it with your jar as a separate item.
 
FelipeGaucho
Posts:983
Registered: 5/25/01
Re: distributing the MySql driver inside a JAR - how to ?   
Nov 23, 2005 10:06 AM (reply 2 of 11)  (In reply to #1 )

 
ok, there is no way to include the driver jar into a single JAR ?
 
DrClap
Posts:38,739
Registered: 4/30/99
Re: distributing the MySql driver inside a JAR - how to ?   
Nov 23, 2005 10:22 AM (reply 3 of 11)  (In reply to #2 )

 
What's so difficult about distributing two files? Most software distributions contain far more files than that.
 
dmbdmb
Posts:4,208
Registered: 5/26/00
Re: distributing the MySql driver inside a JAR - how to ?   
Nov 23, 2005 10:30 AM (reply 4 of 11)  (In reply to #2 )

 
there are tools out there that basically provide a custom class loader to be able to load jars from within jars. one such one is

http://one-jar.sourceforge.net/

and there are others.

frankly, i'm amazed this isn't built in.
 
FelipeGaucho
Posts:983
Registered: 5/25/01
Re: distributing the MySql driver inside a JAR - how to ?   
Nov 23, 2005 10:32 AM (reply 5 of 11)  (In reply to #3 )

 
just technologic curiosity .... you know, pushing Java a bit ahead....

the stress: I need to distribute a ZIP, the user should unzip that and then run te application...

it seems much better the user download a single JAR whithout dependency of external tools...
 
UTK
Posts:1
Registered: 11/25/05
Re: distributing the MySql driver inside a JAR - how to ?   
Nov 25, 2005 6:37 AM (reply 6 of 11)  (In reply to #5 )

 
Maybe it helps you :
"A Read-only database in a jar?"
http://weblogs.java.net/blog/bernt/archive/2005/10/a_readonly_data.html
 
steevcoc
Posts:98
Registered: 8/8/97
Re: distributing the MySql driver inside a JAR - how to ?   
Nov 25, 2005 7:48 AM (reply 7 of 11)  (In reply to original post )

 
Felipe,

I have posted a comment to your blog on this topic (the blog: http://weblogs.java.net/blog/felipegaucho/archive/2005/11/deliver_your_ja.html).

Thanks,
Steev Coco.
 
malcolmmc
Posts:8,610
Registered: 11/9/00
Re: distributing the MySql driver inside a JAR - how to ?   
Nov 25, 2005 8:23 AM (reply 8 of 11)  (In reply to #7 )

 
There's a tool called "GenJar", I found on sourceforge which will assemble a composite jar from a classpath by chasing class references. Runs as an ant task. You'd have to specify the driver class explicitly.
 
strf
Posts:5
Registered: 10/16/98
Re: distributing the MySql driver inside a JAR - how to ?   
Mar 8, 2006 7:06 PM (reply 9 of 11)  (In reply to original post )

 
I usually use ANT to fuse all my jars in one with this task


<jar jarfile="myapp.jar" basedir="classes" excludes="">
 <zipgroupfileset dir="libs" includes="*.jar" />
  <manifest>
   <attribute name="Implementation-Title" value="${name}" />
   <attribute name="Implementation-Version" value="${version}-${build}" />
   <attribute name="Implementation-Vendor" value="${vendor}" />
   <attribute name="Created-By" value="${author}" />
   <attribute name="Main-Class" value="${main}" />
   <attribute name="Class-Path" value="${classpath}" />
  </manifest>
</jar>
 
markg4
Posts:5
Registered: 6/1/06
Re: distributing the MySql driver inside a JAR - how to ?   
Apr 2, 2008 11:00 AM (reply 10 of 11)  (In reply to #9 )

 
Another option is to use a simple JarClassLoader: http://www.jdotsoft.com/JarClassLoader.php
 
cafal
Posts:734
Registered: 12/5/97
Re: distributing the MySql driver inside a JAR - how to ?   
Apr 2, 2008 11:04 AM (reply 11 of 11)  (In reply to #10 )

 
I'm sure the above posters have all been waiting two years for your stirring response. Well done! Now they can get on with their lives.
 
This topic has 11 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 26
  • Guests : 129

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums