Results 1 to 8 of 8
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Create jar file with nested jars programmatically

  1. #1
    yannischris is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Create jar file with nested jars programmatically

    Hello all,
    I want to create a jar which will contain other (nested) jars, and then I want my main class (inside the created jar) to make use of classes within the nested jars. And all this, I want to do it programmatically (e.g. with Runtime.exec()). Is this possible?

    Thanks,
    Last edited by yannischris; 04-03-2012 at 02:48 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: Create jar file with nested jars programmatically

    To get to the classes in the nested jar files you would need your own classloader to find the class files and make them available to the JVM.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    yannischris is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Re: Create jar file with nested jars programmatically

    I see. So you imply that there that this cannot be done using the options of the "jar" command?
    And do you happen to know where I can find some sample code that demonstrates the method you described?

    Thanks,

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: Create jar file with nested jars programmatically

    You can build a jar file with any contents using the jar command.
    The java command will not use nested jar files.

    I don't know of sample code that reads nested jar files for a classloader.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    yannischris is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Re: Create jar file with nested jars programmatically

    So I guess there is no point in placing jars in a jar, if they are not going to be used by the java command.
    Thanks,

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: Create jar file with nested jars programmatically

    You can write code to use the nested jar files. The java command won't use them.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Create jar file with nested jars programmatically


  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Create jar file with nested jars programmatically

    doWhile likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. How can I restart my jvm and program programmatically?
    By guest_user in forum Advanced Java
    Replies: 7
    Last Post: 08-30-2011, 03:45 PM
  2. Replies: 2
    Last Post: 10-24-2010, 05:34 PM
  3. Programmatically starting cell editing in JTable
    By javaexplorer in forum AWT / Swing
    Replies: 2
    Last Post: 05-21-2010, 05:33 PM
  4. Replies: 0
    Last Post: 05-13-2010, 08:03 PM
  5. Close a JDialog Programmatically
    By Marcus in forum Advanced Java
    Replies: 1
    Last Post: 07-06-2007, 05:06 PM

Tags for this Thread

Posting Permissions

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