Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open a specific text file ?

 
steve dowdall
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My program generates a text output file. I'm opening notepad like this:
Runtime.getRuntime().exec("notepad");
It works fine. The question is how can I get a specific .txt file to open using this? Does anyone know the syntax to add the path so that I can point it to the directory (output) and file name (output.txt) where the program generates it to (c:\output\output.txt)?
Thanks,
steve
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime.getRuntime().exec("notepad c:\output\output.txt");
[This message has been edited by Cindy Glass (edited October 11, 2001).]
 
steve dowdall
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cindy,
I had to do this (Windows OS I guess?): Runtime.getRuntime().exec("notepad c:\\Development\\xml-java\\output\\xml-output.txt");
Otherwise I get this error:
Invalid string literal, cannot contain character '\?'.
Runtime.getRuntime().exec("notepad c:\Development\xml java\output\xml-output.txt");
Slan,
Steve
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah - sorry about that . Of course since you figured it out yourself it will stick with you FOREVER .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic