Solved

How to launch a notepad at runtime

Posted on 1997-11-10
1
582 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apps blocked by Java 9 64
replace a word with other 1 40
MySQL  on Tomcat 8 30
Opening PDF on button click and fill new document 2 23
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…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

863 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

24 Experts available now in Live!

Get 1:1 Help Now