This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Post Java execution, opening completed file on Windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Post Java execution, opening completed file on Windows" Watch "Post Java execution, opening completed file on Windows" New topic
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: 12756
    
    5
Are we talking about a HTTP server / client browser architecture here?

Bill
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: 24183
    
  34

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: 19649
    
  18

Or use java.awt.Desktop's open method.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Post Java execution, opening completed file on Windows
 
Similar Threads
Manifest file to jar
free a csv file without closing the java program?
Could you unzip a file with a java program
pdc viewer software needed
Finding the packages for a source file