Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29841

Re: A "current directory" concept for Java...

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: A "current directory" concept for Java...
Date 2014-08-24 18:33 +0000
Organization A noiseless patient Spider
Message-ID <ltdb6k$dm5$1@dont-email.me> (permalink)
References (4 earlier) <slrnlvhgf8.fp3.avl@login.logic.tuwien.ac.at> <ltaqbk$gnc$1@dont-email.me> <slrnlvj9aq.fp3.avl@login.logic.tuwien.ac.at> <ltcfa4$9ag$1@dont-email.me> <slrnlvjqru.fp3.avl@login.logic.tuwien.ac.at>

Show all headers | View raw


On Sun, 24 Aug 2014 13:41:18 +0000, Andreas Leitgeb wrote:

>> I was expecting to have either:
>> - a way of redirecting the standard streams provided by ProcessBuilder
>>   as well as the redirectErrorStream() switch that would do the job
>>   before ProcessBuilder.start is called
>> - the ability to use the Process.getXXXStream() methods before calling
>>   a method that would allow the Process to run.
> 
> The redirection is always done with redirectXxx() methods of
> ProcessBuilder.
>
The only one I can see documented is redirectErrorStream() and that only 
determines whether stderr output is redirected to stdout or not.

Everything else is apparently handled via Process.getXXXStream() methods, 
which surprised me.

> The only thing that appears to me as missing is, when I'd like to tie
> one Process's output to another Process's input. I must admit that I
> haven't seen (nor needed, nor googled) that case, yet.
>
I've run into similar problems with JDBC and when handling blobs and 
clobs: sometimes it seems as if it would be nice to have some sort of 
DataPump object that could be installed between the data source and sink: 
I ended up running the data into a ByreArray as a temp store and then 
pulling it over into the object I needed to manipulate it in.

> so far: yes
> 
>> until the streams have been redirected via the getXXXStream() methods?
> 
> Streams aren't "redirected" by calling getXXXStream(). These streams
> already(from start) have been directed to some pipe.
>
Understood: loose terminology on my part.

> My guesstimate would be: if a process is started from shell, then the
> user has a specific expectation about its "current" dir, and any words
> passed as arguments could be relative paths (even if not (yet) existing
> as files) and therefore the current dir would need to be the current
> directory of the shell.
> Otoh, if a program is started through double click of a File whose type
> is associated to the Program, then the program only gets an absolute
> Path, and thus the current dir is "by definition" irrelevant.
> A third case is, when a Program gets started through a double-click on
> its own icon or a shortcut/link-icon.
>
Yes. I think cases 2 and three are the same: the program thinks other 
files in its installation directory are local to it and anything else has 
to use absolute pathnames. It doesn't matter whether they were clicked on 
in Exploder or selected through the file chooser: the program requires 
absolute pathnames to access them. This becomes quite obvious when you 
write shell scripts that run Windows apps running under Wine.

> I have no idea what current dir to expect there. Fortunately for me,
> these cases are not relevant to my projects at hand ;-)
>
That's good. I only piped up because I wasn't sure if the apps you speak 
of would need to be runnable in a Windows environment


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-22 16:49 +0000
  Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 14:50 -0400
  Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 15:10 -0400
  Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-22 19:26 +0000
    Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-22 23:38 +0000
      Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-23 14:24 +0000
        Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 16:31 +0000
          Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-23 19:34 +0000
            Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 08:42 +0000
              Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-24 10:37 +0000
                Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 13:41 +0000
                Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-24 18:33 +0000
                Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 22:33 +0000
                Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-25 00:14 +0000
  Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 19:45 -0400
    Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 15:32 +0000
      Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-23 12:49 -0400
      Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-23 17:40 -0400
  Re: A "current directory" concept for Java... Jan Burse <janburse@fastmail.fm> - 2014-08-23 10:31 +0200
    With new Path (Re: A "current directory" concept for Java...) Jan Burse <janburse@fastmail.fm> - 2014-08-23 10:48 +0200
      Re: With new Path (Re: A "current directory" concept for Java...) Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 14:38 +0000
  Re: A "current directory" concept for Java... Roedy Green <see_website@mindprod.com.invalid> - 2014-08-23 05:31 -0700

csiph-web