jbenezech has asked for the wisdom of the Perl Monks concerning the following question:

Hi all wise monks, I have a perl/java app running under Win32. The application consists of a perl service (Win32::Daemon) and of java classes. The perl service calls every xx hours java classes to perform some action. The java call looks like this:
Win32::SetChildShowWindow(0); Win32::Process::Create($ProcessObj, $javaExe, $commandArgs, 0, Win32::Process::NORMAL_PRIORITY_CLASS|Win32::Process::CREATE_NO_WINDOW +, $installPath) or $retCode = -9;
The point of SetChildShowWindow(0) and CREATE_NO_WINDOW is to hide the console window that perl usually displays when creating new process.

This worked fine until I tried to run the same code inside a thread.

I now have a perl module JavaCall.pm with "static" subs calling the java classes. My perl service starts a thread each time it needs to call java (if the java process is not started inside a thread, the perl service does not get the shutdown event until the java process finishes). So I have something like this:

perlservice.pl:

sub Callback_Running { $runningThread = threads->new(\&startProcess, $installPath, $executePa +th, $configFile, $parser, $logger, $configref, $Context); $runningThread->detach(); } sub startProcess { JavaCall->callJavaClass(...); }

JavaCall.pm:
Win32::SetChildShowWindow(0); Win32::Process::Create($ProcessObj, $javaExe, $commandArgs, 0, Win32::Process::NORMAL_PRIORITY_CLASS|Win32::Process::CREATE_NO_WINDOW +, $installPath) or $retCode = -9;
And here is the mistery: This works perfect under my Windows XP SP2 Profesional Edition, English. But the console "cmd.exe" shows up on a Windows XP SP2 Home Edition, French. I do not know yet if this problem is specific to Home or French edition.

This app is distributed on users PC and I cannot have that window showing up. Any help greatly appreciated. Jerome

Replies are listed 'Best First'.
Re: Win32 console window & threads
by Anonymous Monk on May 21, 2007 at 04:23 UTC
    javaw is to java as wperl is to perl