Unzip file in java/jsp -


i unziping file using java.

long ago, somewhere i've got class in internet, , stole , kept own usage. complete class is:

package pubapp.data;  import java.io.bufferedoutputstream; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.util.zip.zipentry; import java.util.zip.zipinputstream;   public class unziputility {     private static final int buffer_size = 4096;      public void unzip(string zipfilepath, string destdirectory) throws ioexception {         file destdir = new file(destdirectory);         if (!destdir.exists()) {             destdir.mkdir();         }         zipinputstream zipin = new zipinputstream(new fileinputstream(zipfilepath));         zipentry entry = zipin.getnextentry();         // iterates on entries in zip file         while (entry != null) {             string filepath = destdirectory + file.separator + entry.getname();             if (!entry.isdirectory()) {                 // if entry file, extracts                 extractfile(zipin, filepath);             } else {                 // if entry directory, make directory                 file dir = new file(filepath);                 dir.mkdir();             }             zipin.closeentry();             entry = zipin.getnextentry();         }         zipin.close();     }  private void extractfile(zipinputstream zipin, string filepath) throws ioexception {             try (bufferedoutputstream bos = new bufferedoutputstream(new fileoutputstream(filepath))) {                 byte[] bytesin = new byte[buffer_size];                 int read = 0;                 while ((read = zipin.read(bytesin)) != -1) {                     bos.write(bytesin, 0, read);                 }             }         }     } 

this works in local computer (windows 7, jdk_1.7, tomcat) fine. when upload war remote hosting, no work expected. not create sub directories. web hosting using debian/ubuntu, jdk_1.7, tomcat-7.x

what wrong code in linux?


Comments