Results 1 to 5 of 5
  1. #1
    adam.muller is offline Member
    Join Date
    Aug 2008
    Posts
    2
    Rep Power
    0

    Default How to include lib in JAR file

    Hello everybody,

    this is the first time I'm going to create a real-life JAR, so maybe a bit stupid question but I'm totally out of ideas here...

    Okay, I have a project named WiWClient which depends on other project named common and requires libraries from lib (there are like 20 JAR files). What I need is to somehow put this all together and create a JAR file which will containt everything required.

    I go WiWClient->Export -> Java -> JAR file. On the first screen (select resources to export) I can only select WiWClient and common but not lib. This creates JAR file containg all .class files from both projects, but no libraries from lib.

    In WiWClient -> Project Properties->Java Build Path I have all JARs from lib listed under Libraries and OrderAndExport.

    Can you please give me an advice what I need to do to have everything required included in one JAR which can be then deployed to our server?

    Thanks a lot in advance!
    Adam

  2. #2
    RamSun is offline Member
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Default

    First thing u need not to give all the jar files in to your new jar again, generally we will create the jar file only with the compiled classes if any body using this, it will work.
    The tool is also doing the same thing here.
    Any way you can create the jar file with all folder by using the command prompt like this.
    jar cvf yourjarfilename.jar .
    and try to find the options using this command jar -help

  3. #3
    adam.muller is offline Member
    Join Date
    Aug 2008
    Posts
    2
    Rep Power
    0

    Default

    RamSun: thanks for your reply!

    I need all the JARs in /lib to be able to run my program.
    That thing with command line does include all files (including i.e. sources) and is not what I need.

  4. #4
    RamSun is offline Member
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Default

    u can copy the corresponding class files and lib folder in to newlocation and there u can create the jar.


    --Ram

  5. #5
    mtv134 is offline Member
    Join Date
    Aug 2008
    Posts
    22
    Rep Power
    0

    Default

    what you can do is to copy the jar Lib folder into the common project and change the class path to look for them in the common project itself and then when u export the jars will be contained in the common jar file
    u can add the jars to the class path by right clicking on the project and selecting properties and then going to the Java Build Path and then the libraries tab then choose add jar and selecting your jars

    another option is to use an ear and adding the jars to the dependencies of the ear
    visit http://www.thejavacode.com
    Muhammad Safwat

Similar Threads

  1. How can I include a html file in html textarea?
    By surya_dks in forum New To Java
    Replies: 2
    Last Post: 10-04-2008, 07:20 AM
  2. Replies: 5
    Last Post: 07-29-2008, 02:13 PM
  3. Include file from other proyect
    By oleg_gunnar in forum Advanced Java
    Replies: 1
    Last Post: 03-08-2008, 06:20 PM
  4. Include Java file in HTML Page
    By kathyc in forum New To Java
    Replies: 2
    Last Post: 03-07-2008, 03:51 AM
  5. jsp:include and include file
    By Heather in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-14-2007, 04:19 PM

Posting Permissions

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