• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Executing java file in HTML-page

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi gurus,
Is it possible to execute a .java or .jar or .exe file from HTML-page (with javascript?)? How?
My purpose is to start a little java program when the button or link is clicked in HTML page.
rgds,
Simon.
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you talking about an applet that runs on the client? or something that runs on the server?
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well the basic answer is yes for .class or .jar. how you do it depends on if you do it on the client (applet) or, if your server supports java, on the server (JSP or servlets). i believe you can run .exe using cgi. .java would have to be compiled first
for an applet, you can just load a different page containing the applet when the button or link is clicked. i've done that before. no javascript necessary if a link. for a button i used onclick


<input type='button' value='Sure, why not!' on_Click=\"top.frames[1].location='http://www.javaguy.dns2go.com/examples/Quiz.html'\">


(code looks a little strange because it is really part of a servlet)
(wish i could remember what the backslashes were for)
(had to add underscore for the forum to accept my post)
i had 2 buttons or i could have used <form action="URL"><input type="submit">
[ June 28, 2002: Message edited by: Randall Twede ]
[ June 28, 2002: Message edited by: Randall Twede ]
[ June 28, 2002: Message edited by: Randall Twede ]
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont really understand what are you trying to do, but there is some "related" information:
if this program, that you want to start, located on a client machine, for IE you could use:
var w = new ActiveXObject('WScript.Shell');
w.Run("notepad.exe");
for NS you could use LiveConnect, and execute almost any Java code directly from JavaScript.
For both cases script should be allowed by user to do that.
If it is located a server, but you want it to run on client machine:
I never did it in NS, but in IE, if your link will point to .exe file (and for most others extension) user will choose between "Open" which will run a program and "Save". I guess in NS it something simylar.
 
reply
    Bookmark Topic Watch Topic
  • New Topic