Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7610325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:23:29+00:00 2026-05-31T01:23:29+00:00

I have strange problem with run .exe program in my WebApplication. It works fine

  • 0

I have strange problem with run .exe program in my WebApplication. It works fine in console mode.

My exe application code:

            ...
            Console.WriteLine("before getEnvirement");
            IDictionary environmentVariables = Environment.GetEnvironmentVariables();
            foreach (DictionaryEntry de in environmentVariables)
            {
                Console.WriteLine("  {0} = {1}", de.Key, de.Value);
            }
            Console.WriteLine("before new Application");
            this.application = new App();
            Console.WriteLine("after new Application");
            ...

Where App() is class from COM library (I added reference of course).

My Java console / WebApplication code:

    try {
        String[] callAndArgs = {"C:\\temp\\program.exe", "arg1", "arg2"};
        Process p = Runtime.getRuntime().exec(callAndArgs);
        p.waitFor();
    } catch (IOException e) {
        System.out.println("IOException Error: " + e.getMessage());
    } catch (Exception e) {
        System.out.println("Exception: " + e.getMessage());
    }

Output in “console mode” (correct):

before getEnvirement
  <all my envirements>
before new Application
after new Application

Output in “web application mode” (bad):

before getEnvirement
  Path = C:\Windows\system32; <...>
  TEMP = C:\Windows\TEMP

or when I delete getEnvirement code (also bad):

before getEnvirement
before new Application

Exe application won’t close itself on tomcat (I must use task manager to kill it)

And my questions: Why it dosn’t work correct on tomcat? Why exe program have problems with getting system envirements when I run it on tomcat? And finally: why it works in console mode? 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:23:31+00:00Added an answer on May 31, 2026 at 1:23 am

    I wonder if your spawned process is blocking trying to write its output. From the doc for Process:

    The created subprocess does not have its own terminal or console. All
    its standard io (i.e. stdin, stdout, stderr) operations will be
    redirected to the parent process through three streams
    (getOutputStream(), getInputStream(), getErrorStream()). The parent
    process uses these streams to feed input to and get output from the
    subprocess. Because some native platforms only provide limited buffer
    size for standard input and output streams, failure to promptly write
    the input stream or read the output stream of the subprocess may cause
    the subprocess to block, and even deadlock

    You should be consuming the process’ standard out/err as the process runs, and ideally in separate threads in order to avoid blocking. See this answer for more info.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange problem. I have configured our Websphere Application Server to run
I have a strange problem, my MSBuild runs tests, code-coverage and publishing fine (part
i have a strange problem with truezip. i run the following code: TFile.setDefaultArchiveDetector(new TArchiveDetector(zip));
I have a very strange problem with my code. It will fully run the
I have run into a strange problem, i am creating a lot of dynamically
I have a strange problem. I have designed a windows form application in c#
I'm working with ASP.Net Membership with FormsAuth and have run into a strange problem.
I've run into a strange problem while writing some code for my personal use.
I have strange problem on my pc/server. I run query such as Select field1,
I have a strange problem. Using wsimport I generated als JAX-WS Code from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.