• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with Runtime.getRuntime().exec()  RSS feed

 
Abhishek Mish
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I need to open file in textpad using the below code as
private static final String ADDRESS_FILE="examples/addresses.csv";

Runtime.getRuntime().exec("notepad.exe " + ADDRESS_FILE);

I am facing few problems:

1. If i am trying to open file in textpad then i need to provide the full path of textpad exe instead if i am passing notepad exe then full path
of exe is not required. In that case i need to hard code the path of textpad exe.
2. Also multiple instance of notepad is opened everytime the above code got executed.

Thanks,
Abhishek
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37474
539
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Right. Notepad is on the system path while textpad is not.

2) That's how notepad works. What are you expecting to happen?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!