This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Executing exe using getRuntime.exec() through servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Reply locked New topic

Executing exe using getRuntime.exec() through servlet

Sanjaya Sugiarto
Ranch Hand

Joined: Mar 25, 2004
Posts: 229
Hello everyone,

I have a problem. I need to execute an exe. I have tried with a simple main method and it works like a charm. But as I try to integrate into Tomcat, it hangs. The program uses pdftohtml to convert a pdf into html.

Here is the code:

It hangs just before the waitFor().
Have you guys any idea how to solve this?
Many thanks.

PS: I tried this with tomcat bundled with Netbeans 5.
[ April 09, 2006: Message edited by: Sanjaya Sugiarto ]

<a href="" target="_blank" rel="nofollow">Business Information Technology - Hochschule Furtwangen University, Germany</a>
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12682
I just answered this question in the Servlets forum. It is considered impolite to post the same question to multiple forums. There is nothing Tomcat specific in this question and really it has nothing to do with servlets..

Java Resources at
I agree. Here's the link:
subject: Executing exe using getRuntime.exec() through servlet
Similar Threads
this code runs in TextPad or Kawa but doesn't run in dos promt..!!!!!
Executing exe using getRuntime.exec() through servlet
Process waits forever when using Stringbuffer with more than 2000 strings
wait runtime object finish execution
Killing process spawned by Runtime.exec()