| Author |
Post Java execution, opening completed file on Windows
|
Sean Davidson
Greenhorn
Joined: Jan 10, 2011
Posts: 6
|
|
|
I have this program where I take in an excel file and manipulate it, I currently have it saving to a specific folder. Is there anyway I can have that file open on the user's computer after the program has executed.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
Are we talking about a HTTP server / client browser architecture here?
Bill
|
Java Resources at www.wbrogden.com
|
 |
Sean Davidson
Greenhorn
Joined: Jan 10, 2011
Posts: 6
|
|
No I have this little Applet / Application for my company, it simply takes in an excel file, highlights specific cells. Then saves the new file.
I want my program to open that file on the user's computer once it is saved.
EDIT: So the user doesn't have to go in and open the file him/herself.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
By "Open that file" you mean "Launch Excel with that document opened", yes?
You would use Runtime.exec() to run a command like "cmd.exe /c start foo.xls" . The classic article on Runtime.exec() -- which you absolutely should read! -- is here. It will tell you exactly what to do, and what not to do.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Or use java.awt.Desktop's open method.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Sean Davidson
Greenhorn
Joined: Jan 10, 2011
Posts: 6
|
|
|
Thank you very much, I'll try it in a minute.
|
 |
 |
|
|
subject: Post Java execution, opening completed file on Windows
|
|
|