"countries.geo.json"
(unless changed in GeoJSONReader
manipulates this path) will be relative to the compiled java .class files in the IntelliJ's project out
folder.
If this
in GeoJSONReader.loadData(this, countryFile);
is a PApplet
instance you can use sketchPath()
to make that path relative to the folder from which the sketch runs:
List<Feature> countries = GeoJSONReader.loadData(this, this.sketchPath("data"+File.separator+countryFile));
The above snippet is based on an assumption so the syntax in your code might be slightly different, but hopefully this illustrates how you'd use sketchPath()
.
Additionally there's a dataPath() as well which you can test from your main PApplet in setup()
as a test:
String fullJSONPath = dataPath("countries.geo.json");
println("fullJSONPath: " + fullJSONPath);//hopefully this prints the full path to the json file on your machine
println(new File(fullJSONPath).exists());//hopefully this prints true
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…