Creating a File object out of the contents of jar/zip file

Discussion in 'Java' started by kotauk@gmail.com, Apr 6, 2006.

  1. Guest

    Hi,
    How to create a File object of .java file contained in jar/zip file.
    For eample i have a zip like test.zip
    It has a file mypack.today.MyProg.java

    Give the jar file how to create File object of the MyProg.java.

    Any pointers would be great help

    thanxs
    kota
    , Apr 6, 2006
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > Hi,
    > How to create a File object of .java file contained in jar/zip file.
    > For eample i have a zip like test.zip
    > It has a file mypack.today.MyProg.java
    >
    > Give the jar file how to create File object of the MyProg.java.
    >
    > Any pointers would be great help
    >
    > thanxs
    > kota
    >


    jar -x filename jarname > retrieved_file
    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project
    Fred Kleinschmidt, Apr 6, 2006
    #2
    1. Advertising

  3. Guest

    Hi Fred,
    I want to create java.io.File object programatically

    thanks
    kota
    , Apr 6, 2006
    #3
  4. Guest

    Hi Fred,
    I want to create java.io.File object programatically while reading
    the jar using java.util.jar.JarFile


    thanks
    kota
    , Apr 6, 2006
    #4
  5. wrote:

    > I want to create java.io.File object programatically while reading
    > the jar using java.util.jar.JarFile

    Read <http://java.sun.com/j2se/1.4.2/docs/api/java/util/jar/JarFile.html>.
    There is all you need to get an InputStream for reading a zip-entry of the
    the jar. Open a FileOutputStream for the destination file. Then copy all
    bytes from the InputStream to the FileOutputStream.

    --
    "Thomas:Fritsch$ops.de".replace(':', '.').replace('$', '@')
    Thomas Fritsch, Apr 6, 2006
    #5
  6. Roedy Green Guest

    On 6 Apr 2006 08:09:10 -0700, wrote, quoted or
    indirectly quoted someone who said :

    > I want to create java.io.File object programatically


    new File( ... )
    see http://mindprod.com/jgloss/file.html
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Java custom programming, consulting and coaching.
    Roedy Green, Apr 6, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    543
    Arnold Peters
    Jan 5, 2005
  2. Lee
    Replies:
    4
    Views:
    21,451
    Roedy Green
    Feb 13, 2006
  3. Replies:
    14
    Views:
    427
    Gabriel Genellina
    Mar 1, 2009
  4. m.niinimaki
    Replies:
    9
    Views:
    1,045
    steph
    Aug 29, 2010
  5. Graham Wood
    Replies:
    3
    Views:
    507
    A. Sinan Unur
    Jan 11, 2004
Loading...

Share This Page