Results 1 to 12 of 12
  1. #1
    cjburkey01 is offline Member
    Join Date
    Dec 2013
    Posts
    70
    Rep Power
    0

    Question Copying file INTO a jar File

    Is there a way I can package a file INTO a jar file from a directory, not the other way around?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Copying file INTO a jar File

    Sure, use the -u flag.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    cjburkey01 is offline Member
    Join Date
    Dec 2013
    Posts
    70
    Rep Power
    0

    Default Re: Copying file INTO a jar File

    How would I use -u? I mean from within the program itself, using the Runtime Execution?

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

    Default Re: Copying file INTO a jar File

    Can you write a small test program and see what happens?
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    cjburkey01 is offline Member
    Join Date
    Dec 2013
    Posts
    70
    Rep Power
    0

    Default Re: Copying file INTO a jar File

    Well, I Don't know what exactly -u means, is it a command line argument? Or is it a java argument? I don't understand how you use it

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

    Default Re: Copying file INTO a jar File

    See the doc for the jar command.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    cjburkey01 is offline Member
    Join Date
    Dec 2013
    Posts
    70
    Rep Power
    0

    Default Re: Copying file INTO a jar File

    Quote Originally Posted by Norm View Post
    See the doc for the jar command.
    Where is this? I spent about 15 minutes searching for it, and the only thing that was relatively what I want is this:
    Extracting the Contents of a JAR File (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files)

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

    Default Re: Copying file INTO a jar File

    That's funny. First hit on Google for jar command reference: jar-The Java Archive Tool

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

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

    Default Re: Copying file INTO a jar File

    There is a link here for most of the JDK tools: Java Platform Standard Edition 7 Documentation
    If you don't understand my response, don't ignore it, ask a question.

  10. #10
    cjburkey01 is offline Member
    Join Date
    Dec 2013
    Posts
    70
    Rep Power
    0

    Default Re: Copying file INTO a jar File

    Quote Originally Posted by Norm View Post
    There is a link here for most of the JDK tools: Java Platform Standard Edition 7 Documentation
    Thanks

  11. #11
    cjburkey01 is offline Member
    Join Date
    Dec 2013
    Posts
    70
    Rep Power
    0

    Default Re: Copying file INTO a jar File

    Ah, it means update(More info from running the help command than a website) and then I found this:
    Updating a JAR File (The Java„ Tutorials > Deployment > Packaging Programs in JAR Files)

    EDIT:
    Update is not what I want, I want to copy a file from the jar into a directory on the computer. Not put a file in the jar

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

    Default Re: Copying file INTO a jar File

    I want to copy a file from the jar into a directory on the computer
    Ok, that's somewhat different from what it said in post#1.
    a file INTO a jar file from a directory
    The JarFile, JarEntry and ZipFile, ZipEntry classes have methods that will help with that. Do a Search for some sample code as it is slightly involved.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. copying excel file using jxl API
    By berb12 in forum New To Java
    Replies: 2
    Last Post: 06-11-2014, 06:07 PM
  2. Copying Integer to a file
    By tovaibhav1 in forum New To Java
    Replies: 0
    Last Post: 03-12-2012, 07:43 AM
  3. Replies: 0
    Last Post: 11-12-2011, 02:26 PM
  4. add to a zip file without copying it.
    By yurabita in forum New To Java
    Replies: 5
    Last Post: 08-21-2010, 04:16 AM
  5. problems copying a file
    By atom86 in forum Advanced Java
    Replies: 16
    Last Post: 10-01-2009, 03:40 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
  •