Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to extract rar or zip files in java?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a requirement of extracting a zip file but the problem is that
the zip file contains nested filders and files are present in that folders
  • say like scr-->main-->helloword.class

  • the util.zip only works when there is just files in zip format , but in my case there are folder,
    the util.zip is not working
    can you have any alternative to this ?
     
    Paul Clapham
    Sheriff
    Posts: 21316
    32
    Eclipse IDE Firefox Browser MySQL Database
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You don't need an alternative. Java and the java.util.zip package is perfectly capable of dealing with folders within archives. I expect you haven't written your code to do that.
     
    naved momin
    Ranch Hand
    Posts: 692
    Eclipse IDE Java Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Paul Clapham wrote:You don't need an alternative. Java and the java.util.zip package is perfectly capable of dealing with folders within archives. I expect you haven't written your code to do that.

    this is the code
    what else should i do
    to get that functionality up
     
    Tim Moores
    Bartender
    Posts: 2895
    46
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    That code only ever writes to a single file - how do think it would extract multiple files and/or directories?
     
    naved momin
    Ranch Hand
    Posts: 692
    Eclipse IDE Java Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Tim Moores wrote:That code only ever writes to a single file - how do think it would extract multiple files and/or directories?

    can you modify my code to show
    me how to do that , please?
     
    Tim Moores
    Bartender
    Posts: 2895
    46
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    No, I have better things to do. Start here: http://java.sun.com/developer/technicalArticles/Programming/compression/
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic