Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Servlet Needed Urgently

Posted on 2007-10-17
20
Medium Priority
?
143 Views
Last Modified: 2010-03-30
Hi expert,

Hope you can help me with this.

I need a Servlet that I can use to execute an application(exe) from a link via a web page.

Could someone help me with this please?

Thanks

ST3VO
 
0
Comment
Question by:ST3VO
  • 7
  • 7
  • 6
20 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 20092732
How would you stop unauthorised users doing that?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20092737
Assuming you've addressed that properly, read this thoroughly:

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

You'll need to call Runtime.exec in doGet
0
 
LVL 92

Expert Comment

by:objects
ID: 20092759
here u go:

import java.io.*;
import javax.servlet.http.*;
import javax.servlet.*;

public class ExecServlet extends HttpServlet {
  public void doGet (HttpServletRequest req,
                     HttpServletResponse res)
    throws ServletException, IOException
  {
    Runtime.getRuntime().exec("whatever.exe");
  }
}
0
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.

 
LVL 86

Expert Comment

by:CEHJ
ID: 20092798
That's an excellent example of how *not* to do it. (Read the link i posted)
0
 

Author Comment

by:ST3VO
ID: 20092820
1 question objects, with the servlet be run from the browser and then the servlet executes my exe?

I've written an application with works with a 3D engine and I need to users to be able to run it from a link on the html page.

Due to security issues, this is not possible, so after some research I read that this was possible via a Java Servlet...so that's why i'm posting here :o)

I have no experience with java at all. Do I need to comile your code objects?  Could you point me to some tool to do this please?

Sorry about that...I know nothing about Java :o)

Thanks

ST3VO
0
 
LVL 92

Expert Comment

by:objects
ID: 20092875
> 1 question objects, with the servlet be run from the browser and then the servlet executes my exe?

yes, servlkets run server side

What exactly does the exe do, whats the output?

You may actually want to run it client side, in which case you could use some signed java code to execute it.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20092879
>>I read that this was possible via a Java Servlet...so that's why i'm posting here

It might be possible. What kind of output does your program have? If it has a GUI, you won't be able to do it without a lot of difficulty
0
 

Author Comment

by:ST3VO
ID: 20092986
We yes, it uses DirectX and Windows GUI :o/
0
 
LVL 92

Expert Comment

by:objects
ID: 20093031
then you'll need to run it client side which would require signed code.
Pretty straight forward, you just need a certificate.

Why are you using Java btw?
0
 
LVL 92

Expert Comment

by:objects
ID: 20093041
user could just download the exe directly and run it themselves.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 1500 total points
ID: 20093092
You can't normally just 'run' a Windows application - it needs installation. You would be better off trying to separate the data your app produces from the application itself and try to reproduce the data.

It's also worth checking whether the app supports embedding as an ActiveX control or .NET equivalent
0
 

Author Comment

by:ST3VO
ID: 20093095
Yes, but the prolem is that I need to do it via a web link and due to permission the browser will not let ths happen.
0
 
LVL 92

Expert Comment

by:objects
ID: 20093108
browser won't let you run it, but they can still download it. And include instructions on the page about how to run it once they have downloaded.
A Lot simpler than use signed code to download and execute it.
0
 

Author Comment

by:ST3VO
ID: 20093196
I've already got it working that way but I am required to do it via the brower :o/
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20093213
Then you should provide the kind of interface i mentioned above
0
 

Author Comment

by:ST3VO
ID: 20093282
Thanks guys !!!
0
 
LVL 92

Expert Comment

by:objects
ID: 20093296
Then perhaps you should be going down the .NET route instead of Java
See if this is applicable

http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=187

To do it with Java you'd need to use signed code to download the exe, save it to the local disk and then execute it. Not the cleanest of solutions.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20093311
:-)
0
 

Author Comment

by:ST3VO
ID: 20093316
THanks again!!!

0
 
LVL 92

Expert Comment

by:objects
ID: 20093372
glad I could help :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month21 days, 2 hours left to enroll

810 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