Here you can find the source of getResource(String fileName)
public static File getResource(String fileName)
//package com.java2s; //License from project: BSD License import java.io.File; public class Main { private static String bsearchAppFolderStr = System.getProperty("bsearch.appfolder"); public static File getResource(String fileName) { return new File(attemptResolvePathFromBSearchRoot("resources/" + fileName)); }/* www . j a v a2 s .c o m*/ public static String attemptResolvePathFromBSearchRoot(String pathStr) { // check if the program was started in the NetLogo folder, in which case behaviorsearch is in a subfolder. // NOTE: As of NetLogo 4.1 anyway, // if you don't start the JVM with the NetLogo app folder as the current working directory, // then NetLogo doesn't find its built-in extensions folder, and some other things... File rootDir; if (bsearchAppFolderStr != null && !bsearchAppFolderStr.equals("")) { rootDir = new File(bsearchAppFolderStr); } else { rootDir = new File("behaviorsearch"); } if (rootDir.exists() && rootDir.isDirectory()) { return new File(rootDir, pathStr).getAbsolutePath(); } return pathStr; } }