?
Solved

How to launch an exe from a JSP/ Javascript page

Posted on 2006-05-14
6
Medium Priority
?
547 Views
Last Modified: 2008-03-03
Hi,

I have an exe present in the local machine. I need to launch the exe when the users clicks on a link. I have already tried
           href = "file:///c:/windows/notepad.exe"
This works when I run the file individually, but fails when I run the page from a JSP project.

Please advice.
0
Comment
Question by:Pentech
4 Comments
 
LVL 23

Expert Comment

by:basicinstinct
ID: 16677338
This works in IE:

<a href="javascript:LaunchApp()">Launch the executable</a>

<script>
function LaunchApp() {
 if (!document.all) {
  alert ("Available only with Internet Explorer.");
  return;
 }
 var ws = new ActiveXObject("WScript.Shell");
 ws.Exec("Notepad");
}
</script>

http://www.experts-exchange.com/Web/Web_Languages/Q_20694402.html
0
 

Author Comment

by:Pentech
ID: 16684250
Hi

We need an option that works on all browsers like Mozilla, Netscape etc.

Thanks
0
 

Accepted Solution

by:
massrico earned 252 total points
ID: 16692139
0
 
LVL 3

Assisted Solution

by:a122178
a122178 earned 248 total points
ID: 16725142
Create a new page and just use to call the notepad. The new page should be in a <iframe>

notepad.jsp:

Runtime r = Runtime.getRuntime();
Process p = null;
try{
p = r.exec("c:/windows/notepad.exe");
}
catch(Exception e)
{
}

In your JSP page,

<a href="javascript:LaunchApp()">Launch the executable</a>

<script>
function LaunchApp() {
      document.Notepad.src = "notepad.jsp";
}
</script>

<iframe name="Notepad" src="blank.htm" width="0" height="0">

Hope it helps
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft provides a rich set of technologies for High Availability and Disaster Recovery solutions.
Good news! Plesk 12.5 (with update #28 and above) now includes support for HTTP/2. This is a major update to HTTP1.1, which is over 15 years old. Read below to learn how to enable HTTP/2 on your Media Temple DV with Plesk.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question