Problem with Java writing a Unix Named Pipe - TechRepublic
Question
August 9, 2007 at 09:28 AM
jeremiorama

Problem with Java writing a Unix Named Pipe

by jeremiorama . Updated 16 years, 8 months ago

Hi, I am having a hard time to figure out what is wrong with my Java code.

I created a named pipe with unix like this:

/home/users/myself> mkfifo pipe

Then, in my Java code, I do this:

////////////////////////////////////////////
BufferedWriter lLogPipeWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(“/home/users/myself/pipe”)));
String lLine = lLogPipeReader.write(“helloWorld”);
////////////////////////////////////////////

Am I doing this right or should i avoid some things? It blocks when it tries to create the FileOutputStream. See this is the part of the stack trace where it blocks:

////////////////////////////////////////////
FileOutputStream.open(String) line: not available [native method]
FileOutputStream.(File, boolean) line: 179
FileOutputStream.(String) line: 70
////////////////////////////////////////////

The String given (third line) is the right one (/home/users/myself/pipe). Thus, the File given (second line) is correct and the boolean is ‘false’. It tries to open the file with the String ‘/home/users/myself/pipe’ but it blocks there.

Do you have an idea of what the problem could be?

Thanks a lot!

-Jeremie

This discussion is locked

All Comments