Hi Zeng, You are trying to load a Shapefile. Right?
That is supported by OGR, so you should call: ogr.RegisterAll(); Before trying to open the file. If you are going to open Raster with that same code you should keep your call to: gdal.RegisterAll(); Regards, Ivan > -------Original Message------- > From: zeng <[email protected]> > To: [email protected] > Subject: [gdal-dev] gdal ogr with java > Sent: Mar 29 '10 21:21 > > Hi, buddies > I am using gdal 1.7.1 with java banding, I got a problem when I run > the follow code, there is no out put message. And I am sure the file > exists, I have tried the relative code in c++, it works well. Any one knows > why? > //ShpTest.java > import java.io.IOException; > import org.gdal.gdal.gdal; > import org.gdal.ogr.DataSource; > import org.gdal.ogr.ogr; > public class ShpTest { > public static void main(String args[]) throws IOException { > String filename="f:/test/shp/states.shp"; > gdal.AllRegister(); > DataSource poDS = ogr.Open(filename); > if(poDS == null) > { > System.out.println(gdal.GetLastErrorMsg()); > &n bsp; System.exit( 1 ); > } > System.out.println("test ok"); > poDS.delete(); > } > } > > > -------------------- > _______________________________________________ > gdal-dev mailing list > [LINK: [email protected]] [email protected] > [LINK: http://lists.osgeo.org/mailman/listinfo/gdal-dev] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
