X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_YG X-Spam-Check-By: sourceware.org Message-ID: <4C5328F5.8010909@bopp.net> Date: Fri, 30 Jul 2010 14:33:09 -0500 From: Jeremy Bopp User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Question on Java and Cygwin References: <4C5320F2 DOT 6020207 AT bopp DOT net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 7/30/2010 2:16 PM, Ernest Mueller wrote: > Am trying to use Java file.io without shelling out all the time. To use > cygpath you basically have to spawn shells to do any IO commands, which is > not a best practice. http://www.cygwin.com/acronyms/#PCYMTNQREAIYR :-) With that out of the way, what exactly are you trying to do? Are you trying to open files whose paths are POSIX paths, or are you trying to create paths which you need to hand off to Cygwin processes? Another way of phrasing this is: is your program being called *from* Cygwin or is it trying to call *into* Cygwin? In the former case, those POSIX paths can be converted by whatever is calling your Java program prior to handing off the paths. There would be no extra shell-out for that in most cases. In the latter case, you are already shelling out to call the Cygwin process, so you can integrate the call there to avoid an extra shell-out. The problem you're facing is common for Windows applications (of which Java applications are members) integrating with Cygwin applications. The "ant" script shipped with Apache Ant has some good examples of how to ensure that POSIX paths are handed off to Java correctly. I can't think of a good example offhand for calling into Cygwin, but you can often handle that most simply by creating a script to use as a shim for converting your paths prior which then goes on to call the script or program you really need to run. If there is still confusion, perhaps you could include a short snippet of code which demonstrates what you want to do. -Jeremy -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple