File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes How to include an executable file in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to include an executable file in JSP" Watch "How to include an executable file in JSP" New topic

How to include an executable file in JSP

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
How do i include an executable file in a JSP page & if required make use of any variable in that file with in the JSP?
Executable file may be C,C++ or any file
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
I'm assuming you want to include the output of the executable file, not the file itself. You can use Java's exec() capability to execute programs on the server with input from Java and output captured to an output page.
I would not use that code inside a JSP page directly - it gets too hard to read and REALLY tricky to debug. Create a Bean to handle the execution and you can debug the Bean off-line.
<shameless-plug>There is an example of executing a Perl script from a servlet in my book, also a debugging utility.</shameless-plug>

author of:
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
I came across this code snippet in our IO forum from Carl. Please check.

maha anna
I agree. Here's the link:
subject: How to include an executable file in JSP
It's not a secret anymore!