Showing results for 
Search instead for 
Did you mean: 

IPP + UIC through JNI crashes JVM

I have a small test Java program that reads directory of JPEG's, and makes a call to a native method I wrote in C++ that interfaces with IPP UIC. After a set of JPEG's the VM crashes with an EXCEPTION_ACCESS_VIOLATION

Note: UIC code has ben *untouched* so it is vanilla.

here is output:

# # An unexpected error has been detected by Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c936a12, pid=176, tid=2548 # # Java VM: Java HotSpot Client VM (11.3-b02 mixed mode windows-x86) # Problematic frame: # C [ntdll.dll+0x36a12] # # An error report file with more information is saved as: # C:Documents and Settingsferru001My DocumentssvnScalableImageConversionSystemhs_err_pid176.log # # If you would like to submit a bug report, please visit: # # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # [/plain]
I'm using latest IPP and UIC v.

Here is my C++ code that reads the JPEG's...this is extremely minimalistic because I'm trying to track down solution.

[cpp]JNIEXPORT int JNICALL Java_IPPJPEGDecoder_convertJPEG (JNIEnv * env, jclass jobj, jstring jpeg, jstring tiff)
   CIppImage m_image;
   CStdFileInput in;
   jboolean iscopy;
   const char* jpeg_str=env->GetStringUTFChars(jpeg, &iscopy);

   UIC::BaseStream::TStatus status;
   status = in.Open(jpeg_str);

   if(! UIC::BaseStream::IsOk(status) )
      cout << "ERROR OPENING JPG FILE" << endl;
      return -1;
   PARAMS_JPEG  m_param_jpeg;
   JERRCODE jerr;
   if( JPEG_OK != jerr)
      cout << "ERROR DECODING JPEG"<ReleaseStringUTFChars(jpeg,jpeg_str);
   return (0);

Here is Java class that envokes this method through JNI:

[java]public class IPPJPEGDecoder

    public static native int convertJPEG(String dir, String jpg);
    public static ImageReader myreader = null;

        System.out.println("java.library.path: " + System.getProperty("java.library.path"));

    public static void main(String[] args)
        String directory = args[0];
        System.out.println("JPG directory: " + directory);
        File directoryF = new File(directory);
        String[] children = directoryF.list();
        for (String child : children)
            if (child != null && child.toLowerCase().endsWith("jpg"))
                String jpeg = new File(directory, child).getAbsolutePath();
                String tiff = child.substring(0, child.indexOf(".")) + ".tif";
                int retVal = convertJPEG(jpeg,tiff);

Can anyone see why this code would cause the JVM to crash? If I remove the code that reads the JPEG..the JVM does not crash.


Alessandro Ferrucci
0 Kudos
1 Reply


If calling "Java_IPPJPEGDecoder_convertJPEG" functions or similar code in C++, can this code work?
Just to make sure if the problem is in UIC code or it is related to JNI.

The following are an example to initiate PARAMS_JPEG structure and call ReadImageJPEG.

params_jpeg.color = JC_UNKNOWN;
params_jpeg.comment_size = 0;
params_jpeg.dct_scale = dctscale;
params_jpeg.mode = JPEG_BASELINE;
params_jpeg.nthreads = 1;
params_jpeg.sampling = JS_444;
params_jpeg.use_qdct = 0;

0 Kudos