Hi list,<br>In the context of the GDAL ImageIO integration proposal I&#39;m actually building the framework which will add writing capabilities to the project.<br><br>Today I&#39;m fighting against a strange error with Driver.Create

(...) method.<br><br>From a stand-alone testCase (I&#39;m using Junit) the following code works successfully: <br>------------------------------------------------------------------------------------------------<br>final File outputFile = new File (&quot;d:\\DatiPlugin\\samples\\writingAttempt.jp2&quot;);
<br>final BufferedImage im = 
ImageIO.read(new File(&quot;D:\\DatiPlugin\\bogota.tif&quot;));<br>Driver driver = gdal.GetDriverByName(&quot;JP2ECW&quot;);<br>final int width = im.getWidth();<br>final int height = im.getHeight();<br>Dataset ds = driver.Create

(outFile.getAbsolutePath(), width, height, 1, gdalconstConstants.GDT_Byte,null);<br><br>... some code ...<br><br>ds.GetRasterBand(1).WriteRaster_Direct(0,0,width,height,width,height, gdalconstConstants.GDT_Byte,myByteBuffer);
<br>
ds.FlushCache();<br>ds.delete();<br>------------------------------------------------------------------------------------------------<br><br>However, using the SAME code within the body of the &quot;write&quot; method of the MyJP2KImageWriter class (which extends ImageWriter), it does not work.
<br>(Such a method will be called during an ImageWrite operation performed using JAI-ImageIO toolkit).
<br><br>I noticed that the code only works if I chose a filename with a path containing no subdirectory... As an instance, using &quot;D:\\sample.jp2&quot; instead of &quot;D:\\DatiPlugin\\samples\\sample.jp2&quot;.<br>(Out of curiosity, I tried using a BMP driver and the problem still exist)
<br><br>After a deep debug, I finally noticed that the problem could be attributable to the GDAL methods:<br><br>FILE *VSIFOpenL( const char * pszFilename, const char * pszAccess ) [from cpl_vsil.cpp]<br><br>which calls 
<br><br>
VSIVirtualHandle *VSIWin32FilesystemHandler::Open( const char *pszFilename, const char *pszAccess ) [from cpl_vsil_win32.cpp]<br><br>containing the code<br><br>hFile = CreateFile( pszFilename, dwDesiredAccess, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, dwCreationDisposition,&nbsp; dwFlagsAndAttributes, NULL );
<br><br>which makes hFile equal to INVALID_HANDLE_VALUE (By this reason, the Open method returns NULL).<br><br><br>Could someone provide me some suggestions?<br><br>Thanks a lot.<br>&nbsp;<br>Best Regards,<br>Daniele