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
Solved

tomcat 5 - cgi - execute .exe file

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

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…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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