0

I am facing one issue which is related to unzipping .xsn file from java code. I am stuck up with and looking for some resolution.

Guys can you please help me out from this problem?

I have tried with java traditional code to ZipFile class.

Wtower
  • 18,848
  • 11
  • 103
  • 80
Ashish Mishra
  • 169
  • 16

2 Answers2

2

Below is the answer for my requirement which might be useful to you.

        String command = "expand \"C:\\Users\\amishra\\Desktop\\backup\\BOM.xsn\" \"C:\\Users\\amishra\\Desktop\\backup\" -F:*";            
        Process process = Runtime.getRuntime().exec(command);

        BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
        BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));

        String s;

        while ((s = stdInput.readLine()) != null) {
            System.out.println(s);
        }

        // Read command errors
        System.out.println("Standard error: ");
        while ((s = stdError.readLine()) != null) {
            System.out.println(s);
        }
Ashish Mishra
  • 169
  • 16
1

The XSN file is really a CAB file. Try checking out the Microsoft CAB SDK here

http://support.microsoft.com/?scid=kb;EN-US;310618

Mohit
  • 1,185
  • 2
  • 11
  • 25
  • Thanks Mohit for your quick response. But i need to extract the same with the use of java technologies. – Ashish Mishra Sep 19 '14 at 12:34
  • XSN file is the archive containing many files (you can extract them , for example, by changing .xsn extension to .cab). For CAB files i already posted the url. – Mohit Sep 19 '14 at 12:45
  • Thanks a lot Mohit for your quick response again. I have tried with microsoft native command 'expand'[Win7 onwards] and 'extract'[Lower than Win7]. Its perfectly works for my requirement. Thanks a lot. Below is my code snippet for achieving same. – Ashish Mishra Sep 19 '14 at 13:51