I\'m a beginner at programming and get pretty confused when trying to use external libraries. I have my maps in shapefiles that I convert to GeoJSON using the website Mapsha
First you need to install the Java Bindings (see here at the bottom). Than download the ogr2ogr.java from here (scroll down -> download original format -> put it into your project folder).
Than it gets quite easy. You just cann call ogr2ogr.java's main method. ogr2ogr -f GeoJSON -t_srs crs:84 [name].geojson [name].shp
:
String[] cmd = {"-t_srs", "CRS:84", "-f", "GeoJSON","[name].geojson","[name].shp"};
ogr2ogr.main(cmd);