Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

We have program( written in VB ) using a call to a winzip program or 7zip command line tool to zip some files. Once I accidentally uninstall the winzip on my computer and making one of our program( created by the programmer already left ) crashed. So we cannot uninstall the winzip program.

Now we am writing another program with java + windows batch file. And I've come to a point which I need to make a decision between 1) using a call to external tool ( for example 7z ) for gzip in windows batch file, 2) or I make a java program to gzip the file.

Obviously a external tool such as 7z is convenient and we can avoid some extra coding with java. On the contrary, if 7z is uninstalled accidentally, our program will crash. What do you think?

share|improve this question
8  
You can and should package whatever tools you need with your app if their license allows doing so (and if it doesn't, find a tool that allows redistribution). That way there's no risk of the tools not being available to you at runtime. –  Anna Lear Mar 22 '12 at 4:17
1  
We have program using a call to a winzip program, we are using shell script. Which is it? The approach to take will be different for each. –  StuperUser Mar 22 '12 at 13:31
1  
its not 100% clear if your distributed software relies on winzip or just your build system? –  jk. Mar 22 '12 at 14:13
    
@StuperUser I've elaborated the detail to avoid confusion. Thanks. –  lamwaiman1988 Mar 23 '12 at 2:08

3 Answers 3

To save your program from Crash, you have to add your necessary dll from that application. But i warn you that it should not break any liecense agreement

share|improve this answer
    
-1. He's not calling the DLL. He's calling the executable. –  user16764 Mar 23 '12 at 2:09

In the case of zipping capabilities in a Java program, you shouldn't need to delegate to an external program like winzip or 7zip. Have you looked into the standard Java zipping functionality? The ZipOutputStream in partcular should be able to do what you need. I haven't used it to create zips (or gzips) myself but I would expect it to be easier than calling an external program, especially when it comes to error handling.

share|improve this answer
    
Calling the external program is easier when we are using shell script. I am not going to call the external program in java. –  lamwaiman1988 Mar 22 '12 at 6:09
    
Sorry I was thinking that your main program was written in Java... Not sure why I got so many up-votes if that is the case. –  Gary Buyn Mar 22 '12 at 19:33
    
Still though, it can save you hassles to avoid reliance on 3rd party apps where you don't need to. For example, they may end up having incompatibilities with OS versions etc. –  Gary Buyn Mar 22 '12 at 19:37

If your program crashes in the absence of 7zip, you have to add some very basic thing every program should have: it is called "error handling". For example, if 7zip is missing at the place where you expect it, your program could display an error message telling the user what went wrong and that you expect 7zip to be installed. And (as far as I known), current license of 7zip is mostly LGPL, so redistributing it (without modification) should be no probem (but IANAL).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.