I am trying to read geojson files from the resources file that i have but i get java.nio.file.NoSuchFileException.
package org.readers;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class jsonreader {
public static void main(String[] args) {
String[] filePaths = {
"src/main/resources/geojson/amenity.geojson",
"src/main/resources/geojson/shop.geojson",
"src/main/resources/geojson/tourism.geojson"
};
String filename="src/main/resources/geojson/amenity.geojson";
Path pathToFile = Paths.get(filename);
System.out.println(pathToFile.toAbsolutePath());
System.out.println("Current working directory: " + System.getProperty("user.dir"));
//the rest
New contributor
Cem Andrew Gultekin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.