Solved

tomcat 5 - cgi - execute .exe file

Posted on 2003-11-17
4
1,966 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 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