Solved

How to launch a notepad at runtime

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 134
by zero exception 10 81
pagenation logic how it is working in my code 1 80
how to debug htl and js pages 8 77
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…
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 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 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 …
Suggested Courses

737 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