aspose file tools*
The moose likes JSP and the fly likes want to open notepad from client machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "want to open notepad from client machine" Watch "want to open notepad from client machine" New topic
Author

want to open notepad from client machine

Saphalya Swain
Greenhorn

Joined: Jan 29, 2007
Posts: 8
hi...
i have a link in *****.jsp to notepad.exe but i am not able to open the notepad, please help me

************************Code is*****************
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<a href="C:\WINDOWS\system32\notepad.exe">Notepad</a>
</body>
</html>

********************Code Over*********************
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39571
    
  27
You can't open a local executable program from a hyperlink. It would be a huge security hole if that were possible.


Ping & DNS - updated with new look and Ping home screen widget
Saphalya Swain
Greenhorn

Joined: Jan 29, 2007
Posts: 8
can we do this "activex" or something else
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39571
    
  27
Why can't the user open an editor himself? You'd be restricting yourself to one particular browser on one particular operating system - can you afford to do that?
sreekanth nair
Greenhorn

Joined: Mar 12, 2007
Posts: 20
if you are using JSP then there is a way to open a notepad or what ever System specific executable. Opening directly using a hyper link, i think it is not possible. but you write a javascript function by including the following JSP scriptlet and call it from that Links onclick event
<% Runtime run = Runtime.getRuntime();
Process p = run.exec("notepad.exe");
try{ p.waitFor(); }
catch(InterruptedException e)
{ System.out.println(e); } %>
Instead of "notepad.exe", if you give "calc.exe" it will open a calculator. like wise you can open any executable (System specific) through this code.-->
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39571
    
  27
Note that sreekanths suggestion causes Notepad to be run on the server, not on the client, where the web page is displayed. Also, it may fail if the servlet container is run with a security manager, which do not typically allow Runtime.exec to be used.
sreekanth nair
Greenhorn

Joined: Mar 12, 2007
Posts: 20
What He said was correct, If you are running server (Tomcat or other) locally you can open in your own machine. If you try to open it from another machine it won't open there but it will open in your machine.
Tejas Tambe
Ranch Hand

Joined: Oct 08, 2001
Posts: 47
Hello Saphalya,

You can achieve this by using the Shell API.
Check this out - How to use Shell API
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: want to open notepad from client machine
 
Similar Threads
Output of RequestDispatcher include with JSP?
Error while testing attributes
Problem with forwarding page towards error page
JSP: DownLoad a file
Export to excel