wood burning stoves 2.0*
The moose likes JSP and the fly likes Executing jars from jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Executing jars from jsp" Watch "Executing jars from jsp" New topic
Author

Executing jars from jsp

Bony Sen
Greenhorn

Joined: Dec 02, 2008
Posts: 23
Hi,

I need to make a jsp in which I have to provide links to various java applications.
Is it possible to define the link in such a way that the application associated with that link is executed on clicking the link?

Thanks
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

application needs to be execute on client side or server side?
Bony Sen
Greenhorn

Joined: Dec 02, 2008
Posts: 23
Server-side
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

use different action or one action with different param value
Bony Sen
Greenhorn

Joined: Dec 02, 2008
Posts: 23
Could you please elaborate with an example illustrating the syntax.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What do you mean by "executing jars"?
Bony Sen
Greenhorn

Joined: Dec 02, 2008
Posts: 23
We have a jar file of the code which we run through command prompt using:
java <Classname> <parameters>
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Depending on your actual needs it may just be easiest to exec them... this strikes me as an odd way to go about this, but it's hard to say with not much info to go on.
Bony Sen
Greenhorn

Joined: Dec 02, 2008
Posts: 23
I have got jars created for various applications which are normally run via command prompt. I want to provide the user easy access to these applications by providing links for these in a web page. Is it possible to execute such an application(in jar form or otherwise) through a jsp?
Wayan Saryada
Ranch Hand

Joined: Feb 05, 2004
Posts: 105

Did you mean that you want executing applications like Java Swing applications? Maybe what you are you looking is something like Java Web Start?


Website: Learn Java by Examples
Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 420
    
    2

Add a servlet to execute your jars, use the java ProcessBuilder class. Your jsp can either send the servlet the actual text to execute (massive security hole) or a description of the 'jar' it needs to execute and have the servlet construct the actual command to execute eg java -jar command. As the commands you are executing are actually java it does beg the question as to why you don't just link use them directly ??


"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executing jars from jsp