{"id":4883,"date":"2014-03-30T16:25:30","date_gmt":"2014-03-30T16:25:30","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/execute-exe-on-java-who-require-some-library-collection-of-common-programming-errors\/"},"modified":"2014-03-30T16:25:30","modified_gmt":"2014-03-30T16:25:30","slug":"execute-exe-on-java-who-require-some-library-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/execute-exe-on-java-who-require-some-library-collection-of-common-programming-errors\/","title":{"rendered":"Execute .exe on java, who require some library-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/eb73987262fa25c286c6054bd51abff4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nagonist_<\/p>\n<p>I have a little problem today,I want to use this tool http:\/\/freecode.com\/projects\/jpegoptim on my java program. But on windows it&#8217;s only work with Cygwin after install jpeg library.<\/p>\n<p>So my question is : How I can run it on my java program like :<\/p>\n<pre><code>String[] cmd = {\"C:\\\\Users\\\\Bastien\\\\Desktop\\\\jpegoptim\\\\jpegoptim.exe\", \"some args\"};\n    try {\n        Runtime rt = Runtime.getRuntime();\n        Process pr = rt.exec(cmd);\n<\/code><\/pre>\n<p>thanks if a solution exist.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/E3mRg.png?s=32&amp;g=1\" \/><br \/>\nEugeny Loy<\/p>\n<p>If you do not bother about distribution\/licensing stuff &#8211; figure out what dll&#8217;s your app depend on and place them near to your exe.<\/p>\n<p>That&#8217;s the easies way to &#8220;make it work&#8221;.<\/p>\n<p>You have 2 general ways to determine what dll&#8217;s your app depend on:<\/p>\n<ol>\n<li>\n<p>Run app and see what it requires (windows should give you a message with missing dll) &#8211; nmot convenient bu most reliable.<\/p>\n<\/li>\n<li>\n<p>Use static analysis tools like this to analyse exe dependencies &#8211; should work for most of the cases.<\/p>\n<\/li>\n<\/ol>\n<p>Be warned that this is rather ad-hoc method and I would not suggest you to do something like that in production.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/147c5a9cc1feec049c50da791ac7d144?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nStephen C<\/p>\n<p>By far the simplest approach is to install Cygwin.<\/p>\n<p>If you can&#8217;t (or won&#8217;t) do that, there are a couple of things you could try, though neither is guaranteed to succeed:<\/p>\n<ol>\n<li>\n<p>You could download the source code and attempt to build it for native windows using your favourite Windows C or C++ (or whatever) compiler. If this fails (and it probably will), you could attempt <em>port<\/em> the code, replacing UNIX-specific library with the equivalent Windows library calls. Warning: you need some C \/ C++ and Windows programming skill to pull this off.<\/p>\n<\/li>\n<li>\n<p>You could attempt to identify and provide all of the DLLs that the application needs to run. However, some of those DLLs will be part of Cygwin, so you&#8217;ll need to download Cygwin to get hold of them in the first place.<\/p>\n<\/li>\n<\/ol>\n<p>BEWARE: if your intent is to redistribute this, redistributing Cygwin DLLs in your installer (or whatever) <em>may<\/em> mean that your code needs to adhere to the terms of the Cygwin License. That is basically GPL 3+ with an exception. Alternatively you can get (i.e. pay for) a special license from RedHat. Either way, do your own research and\/or get competent advice on the licensing implications.<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>agonist_ I have a little problem today,I want to use this tool http:\/\/freecode.com\/projects\/jpegoptim on my java program. But on windows it&#8217;s only work with Cygwin after install jpeg library. So my question is : How I can run it on my java program like : String[] cmd = {&#8220;C:\\\\Users\\\\Bastien\\\\Desktop\\\\jpegoptim\\\\jpegoptim.exe&#8221;, &#8220;some args&#8221;}; try { Runtime rt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4883","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4883"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4883\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}