Solved

tomcat 5 - cgi - execute .exe file

Posted on 2003-11-17
4
1,948 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Redirect from old domain to new domain 19 76
Laravel Forge - What is it? (But in non-developer language:) ) 3 93
Setting up a WAMP server... 7 66
ignore other .htaccess 2 69
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

679 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