• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

want to open notepad from client machine

 
Saphalya Swain
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't open a local executable program from a hyperlink. It would be a huge security hole if that were possible.
 
Saphalya Swain
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we do this "activex" or something else
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Saphalya,

You can achieve this by using the Shell API.
Check this out - How to use Shell API
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic