i developed application which will converts tiff,jpeg,pdfs in a zip file to single pdf,and its working fine and size is also similar to original files , but i need to compress the pdf ( save my file server memory) i searched in google , i got ghost script which will reduce the size of 5mb pdf to 50kb,and i manually executed same in linux and its working fine,but i want to run same command in java programme, but i dont know how to run linux command in java programme since i am new to java i am facing difficulties,can any one post sample programme how to run linux commands in java ,so i can try myself
Asked
Active
Viewed 543 times
-3
-
possible duplicate of [Java execute command line program](http://stackoverflow.com/questions/9346077/java-execute-command-line-program) – Colin D Dec 30 '14 at 18:32
-
Sounds like premature optimization... 5MB is not a lot, whether it be working memory or storage size. – Brendan Lesniak Dec 30 '14 at 18:32
-
Have you tried using compression options which are already in java such as gzip or any of options in the apache commons-compress library? http://docs.oracle.com/javase/8/docs/api/java/util/zip/GZIPOutputStream.html http://commons.apache.org/proper/commons-compress/ – Brett Okken Dec 30 '14 at 18:35
-
Around 4lakhs users will use this application.space will be(4lakh*5mb)..thats y – Mahesh Dec 30 '14 at 18:36
-
You couldnt have possibly googled for the answer to this question because it is a very easy answer to find if you actually did google for it. This is a duplicate; thanks Colin D. – searchengine27 Dec 30 '14 at 18:39
1 Answers
2
What you want to do should be able to be achieved by simply running a bash script, which is pretty simple. Also it happens that someone has asked that question before so that answer should in turn answer yours. Please let me know if you want a more detailed response or need help with the implementation.

Community
- 1
- 1

Colin Cooke
- 36
- 3