Solved

How to launch a notepad at runtime

Posted on 1997-11-10
1
583 Views
Last Modified: 2006-11-17
Hi
   I have a requirement of Launching a Notepad from a Java
application at Run Time, and write on some message on to that Notepad. How to do that?

I have used following command
try
{
   Runtime.getRuntime.exec("notepad");
}
catch(Exception e)
{}

exec() method returns me a Process. But i am not able to get any reference of that notepad so that i can write into that.

Will any body explain me with full code how to do that.

regards
0
Comment
Question by:sadik102097
1 Comment
 
LVL 3

Accepted Solution

by:
gwalters earned 50 total points
ID: 1230315
You'll have to create a file containing what you want in notepad, then pass that file as an argument.

FileOutputStream out=new FileOutputStream("tempfile");
...
out.close();
Runtime.getRuntime.exec("notepad tempfile");



0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

775 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