Solved

PrintStream write(String) method

Posted on 2004-03-27
4
901 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

617 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