Page 1 of 1

Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T07:05:23-07:00
by ai@aiedv.ch
Dear ImageMagick Team,
I have a strange new problem calling newer ImageMagick versions from Java on Windows machines.
Since several years I am calling ImageMagick from Java without any problems.

My application can detect and call any installed or uninstalled ImageMagick.
This was working fine up to the version 6.4.1. Now I need to update ImageMagick to a newer version 6.5.x

Everything works fine on an OSX machine (no problems at all).
However:
When trying to call version 6.5.5 from Java on a Windows XP machine, the runtime returns with the error 0xc150004 (process could not be initialised).
No problem if the same software calls version 6.4.1.

The registry is set with correct values.
I am passing the following Strings to the environment which works fine for older IM versions (of course with other/correct paths):

MAGICK_HOME=C:\Programme\BatchXSLT4InDesign\BatchXSLT\Utilities\Imaging\Win\im\6.5.5
MAGICK_CONFIGURE_PATH=C:\Programme\BatchXSLT4InDesign\BatchXSLT\Utilities\Imaging\Win\im\6.5.5\config
MAGICK_CODER_MODULE_PATH=C:\Programme\BatchXSLT4InDesign\BatchXSLT\Utilities\Imaging\Win\im\6.5.5\modules\coders
MAGICK_CODER_FILTER_PATH=C:\Programme\BatchXSLT4InDesign\BatchXSLT\Utilities\Imaging\Win\im\6.5.5\modules\filters
Path=C:\Programme\BatchXSLT4InDesign\BatchXSLT\Utilities\Imaging\Win\im\6.5.5;C:\Programme\BatchXSLT4InDesign\BatchXSLT\Utilities\Imaging\Win\gs\8.70\bin;%Path%
GS_LIB=C:\Programme\BatchXSLT4InDesign\BatchXSLT\Utilities\Imaging\Win\gs\8.70\lib;C:\Programme\BatchXSLT4InDesign\BatchXSLT\Utilities\Imaging\Win\gs\8.70\fonts;

These also can be the paths to an installed version - same problem.

The strange thing is: when I do NOT pass ANY environment variables then ImageMagick starts (sure it does not work properly but the process can be initialized and ImageMagick can be loaded).
Calling an installed or uninstalled IM 6.5.x manually from the command prompt works fine.
No 6.5.x version can be called from Java. Any dll and static including the one for package distribution.

As far as I have found out until yet: all older versions (installed or package distr. at least up to 6.4.1) could be installed and/or delivered in a package and were working fine as long as the registry AND the environment variables were properly set.
Google did not really help. One discussion mentioned that evtl. mfc90.dll can not be found and loaded.

To mention again: this problem exists only on Windows with newer 6.5.x IM versions.
As all calls from Java work fine with older versions, I think that this could be a bug.

Do you have any hint for me? What am I missing?
Thank you for your help.
Andreas

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T07:08:20-07:00
by magick
Did you install the Visual C++ 2008 Redistributable Package (x86) or Visual C++ 2008 Redistributable Package (x64) as discussed near the bottom of this page: http://www.imagemagick.org/script/binar ... hp#windows?

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T07:23:40-07:00
by ai@aiedv.ch
magick wrote:Did you install the Visual C++ 2008 Redistributable Package (x86) or Visual C++ 2008 Redistributable Package (x64) as discussed near the bottom of this page: http://www.imagemagick.org/script/binar ... hp#windows?
Thanks for the hint! I'll check this and will be back.

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T07:37:30-07:00
by ai@aiedv.ch
ai@aiedv.ch wrote:
magick wrote:Did you install the Visual C++ 2008 Redistributable Package (x86) or Visual C++ 2008 Redistributable Package (x64) as discussed near the bottom of this page: http://www.imagemagick.org/script/binar ... hp#windows?
Thanks for the hint! I'll check this and will be back.
Unfortunately no luck.
I had installed Visual Studio 2008.
Uninstalling and reinstalling the Visual C++ 2008 Redistributable Package made no difference.
6.4.1 work with and without this package, with 6.5.5 the java runtime fails to load

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T08:03:48-07:00
by magick
Perhaps its an incompatibility with the Java interface to ImageMagick. Try a few command line commands and see if they work properly. From a Command Prompt window type
  • convert logo: logo.png
    identify -verbose logo.png
    imdisplay logo.png
Do these commands work properly? If so it suggests ImageMagick is fine and the problem is with the Java interface to ImaegMagick

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T08:29:12-07:00
by ai@aiedv.ch
magick wrote:Perhaps its an incompatibility with the Java interface to ImageMagick. Try a few command line commands and see if they work properly. From a Command Prompt window type
  • convert logo: logo.png
    identify -verbose logo.png
    imdisplay logo.png
Do these commands work properly? If so it suggests ImageMagick is fine and the problem is with the Java interface to ImaegMagick
Yes, in manual command mode IM works fine. That's the strange thing.
I have checked and revised the Java interface 100 times to find out a reason.
And the Java call works fine (since many years) with older versions.
I am not saying that the Java interface could not be wrong. But why is the same Java interface working fine with previous IM versions and on OSX? This problem must have started with one of the windows versions following 6.4.1. Unfortunately I can not download enough previous binaries to be able to exactly say at which version the problem started.

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T08:54:02-07:00
by fmw42
I am sticking my dumb nose into this, but the only 'sticky wicket' that keeps coming up in recent versions of IM (causing slow downs) is OpenMP. On a whim, try disabling it in the compile and see if that makes any difference. Be sure to use the latest IM as well, since the one version you are using may have had a bug.

Perhaps Magick can comment on this and whether that might have any bearing on the problem.

Also I think there have been some changes to the png interface of late. So can you process any other format, gif or jpg without problems?

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T09:17:54-07:00
by ai@aiedv.ch
fmw42 wrote:I am sticking my dumb nose into this, but the only 'sticky wicket' that keeps coming up in recent versions of IM (causing slow downs) is OpenMP. On a whim, try disabling it in the compile and see if that makes any difference. Be sure to use the latest IM as well, since the one version you are using may have had a bug.

Perhaps Magick can comment on this and whether that might have any bearing on the problem.

Also I think there have been some changes to the png interface of late. So can you process any other format, gif or jpg without problems?
Thanks for sticking your nose into this!
I am using 6.5.5-3 ( have tried 6.5.4 and 6.5.5-2) - the binary version. It is absolutely important, that users can install newer binaries and my software package will recognize and use it. So, IM binaries have to run "as is".
The current problem is that the IM (v 6.5.x) process can not be initialized (and dies) when called from Java. I would be glad if IM would at least start.
6.4.1 called from Java runs perfectly with any image format.
A question could be: "what has changed in IM at a certain version in handling environment and parameters?" or "what does IM urgently need and is not provided by the Java runtime?". Sorry, if I am on the wrong way with these questions but I am trying to solve this since more than a week.

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T09:51:31-07:00
by fmw42
Have you tried installing from source rather than from binary?

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T09:56:42-07:00
by ai@aiedv.ch
Yes, no difference: 6.5.x windows fails to load (binary or from source).
6.5.x on OSX (installed from source) works fine on an Intel and PPC machine with the same Java interface.

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T10:28:40-07:00
by fmw42
did you try disabling OpenMP in your source install. Other than that, I am at a loss and perhaps some PC expert can comment. I am on a Mac, but use command line and not Java or any other API.

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T13:09:53-07:00
by ai@aiedv.ch
I'll try this and will be back.
However, I would not be very happy if I had to recompile every new version.
Thanks for all hints.

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-08-27T15:25:11-07:00
by fmw42
You do have to recompile with every new version if you install from source. Sorry, but I think that is the way it is.

I have to recompile every time I just change my config for a different Q level.

Re: Calling 6.5.x from Java returns error 0xc150004

Posted: 2009-09-16T12:08:07-07:00
by Zebr911
Try to pass environment variable "SystemRoot" along with other variables. If this solution works for you, it means that ImageMagick 6.5 got new internal undocumented dependency.

PS: Found this solution in thread about Python :-) http://bugs.python.org/issue3440
PPS: And error code is 0xc0150004 or -1072365564