Solved

tomcat 5 - cgi - execute .exe file

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to redirect https://www to non-www? 6 72
PHP Upload using Uploadify 4 71
Updating PHP in Windows Server 2012 r2 22 103
HHTP and HTTPS redirect question 3 96
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 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

14 Experts available now in Live!

Get 1:1 Help Now