Solved

tomcat 5 - cgi - execute .exe file

Posted on 2003-11-17
4
1,927 Views
Last Modified: 2012-06-22
My problem is that I have a tomcat 5 installed, everything is set up right, use of Perl files in the cgi bin works fine.
But i want to execute a exe file.
Im developing with NetBeans IDE, with builtin tomcat 4.
When i test my things on the NetBeans Tomcat everything works.
I export the war file and put it into the webapps dir, it deploys and everything works, but the read.exe gives no result.
in the localhost_log i get the error: unrecognized character
I think the tomcat thinks that the .exe file is a perl script and tries to interpret it.
Where can i say "don´t interpret it just call it".

I uncommented the cgi lines in the web.xml
I have a servlet mapping in the context/web.xml
i renamed the servlets-cgi.jar

Please don´t tell me "use Apache to process cgi´s"
There must be a way to get this to work.

0
Comment
Question by:Koma666
  • 2
4 Comments
 
LVL 2

Expert Comment

by:rootkiddy
ID: 9766931
I set this up and played with it and notice one big thing.  It appears as though tomcat wants cgi scripts not executables based on the errors I seen in the log files.  Basically in the log files it complains about parsing line 1 which is where you would call the interpreter such as perl in a script.  After doing several searches out there to see how others have overcome this, I noticed most have been going to apache for this.  If you are all for doing this with tomcat you can use a wrapper like a perl script or even java servlet that will do nothing but execute your backend script and relay it back to the end user.

Brief example of single script wrapper.

#!c:\perl\bin\perl.exe

system("myfile.exe");
0
 
LVL 5

Author Comment

by:Koma666
ID: 9769408
I found out that Tomcat  4.0.6  executes the .exe files the way i want it.
But i can´t understand why the newer versions don´t do that.
I would like to use the tomcat 5 versions if there is anyone out there who knows a workaround.

@rootkiddy thx, i´ll give it a try

0
 
LVL 5

Author Comment

by:Koma666
ID: 11395927
I found a solution on my own.
I don´t start the exe by cgi, i do it by java.

String javaexecString = new String("winword");
Process myProcess= Runtime.getRuntime().exec(javaExecString);

i think thats much better than the cgi version.
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 11397321
Closed, 125 points refunded.
ee_ai_construct (.ai.)
Community Support Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MDB2 Error: not found 4 135
Duplicate Records In MySQL 7 49
XAMPP 3 44
apache and php 3 90
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now