Solved

PrintStream write(String) method

Posted on 2004-03-27
4
817 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now