Solved

PrintStream write(String) method

Posted on 2004-03-27
4
840 Views
Last Modified: 2008-02-01
void executeScript(String script, PrintStream ps) throws IOException
{
  String cmd = "source " + script;
  Process p = Runtime.getRuntime().exec(cmd);
  BufferedReader reader = new BufferedReader( new InputStreamReader( p.getInputStream() ) );

  String output = reader.readLine();

  while (output != null)
  {
    ps.write(output);
    output = reader.readLine();
  } // end while

} // end executeScript(File, PrintStream)

Any reason why "ps.write(output)" gives:
    write(java.lang.String) has private access in java.io.PrintStream
0
Comment
Question by:DJmistral
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 10696159
cause it is declared private :)

try instead:

ps.println(output);
0
 

Author Comment

by:DJmistral
ID: 10696202
Doh! Thanks!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
simple java question 3 56
nextBoolean(double p) for Random class 3 40
JAVA API design with micro service cloud in mind 1 19
Html Table Looping (part 2) 5 11
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question