runtime.exec in Linux

K

K McNeil

Is there a way to launch an Excel spreadsheet from a jsp page on a Linux server?

In windows it's
runtime.exec(new String[] { "rundll32", "url.dll,FileProtocolHandler",
C:\excelDirectory\excelFile.xlt} );
 
J

John C. Bollinger

K said:
Is there a way to launch an Excel spreadsheet from a jsp page on a Linux server?

In windows it's
runtime.exec(new String[] { "rundll32", "url.dll,FileProtocolHandler",
C:\excelDirectory\excelFile.xlt} );

Presumably you at least need to put some additional quotes into that and
make sure to initialize variable "runtime" to something sensible.

To answer your question: it depends. The Java code in your JSP runs on
the server, not the client, so you cannot use it to do anything directly
on the client. What you can (try) to do is to make your JSP or servlet
create a response which will prompt the client to do what you want.

If the spreadsheet lives on the server then the answer is probably to
just send the the raw spreadsheet data as the response entity, with the
appropriate MIME type (look it up) and perhaps some shenanigans with
naming. This job is more appropriate for a pure servlet than for a JSP.
Do note that in this scenario, any changes the user makes to the sheet
will not be reflected on the server.

If the spreadsheet lives on the client or is to be accessed on the
client via a network share, then you need some kind of code that will
run on the client. That typically takes the form of JavaScript, which
you would include in an HTML response from your JSP. I'm afraid I can't
help with the JavaScript details, but very likely one of the free
JavaScript repositories has just what you would need.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top