I'm working on a project that I started, and an attempting my first shot at networking so to speak. Lets say my program looks for "updates" by reading in a few lines from a textfile on a webserver. I can do that fine. Now lets say it wants to look for updates to plugins. If the base path to the plugin's update is known and the extention of the information file, how would I search for that file? I know that on some web servers, when you go up one in a directory, it lists the contents of that directory. Here's the code that i'm using:
but i'm getting null pointer exceptions on this line:File[] listOfFiles = new File(currentURL.getPath()).listFiles(); for (int i = 0; i < listOfFiles.length; i++){ if (listOfFiles[i].isFile()){ if (listOfFiles[i].getName().endsWith(".info") || listOfFiles[i].getName().endsWith(".INFO")) { hasFoundInfoFile = true; InfoFile = listOfFiles[i].getAbsoluteFile(); } if (hasFoundInfoFile) break; } }for (int i = 0; i < listOfFiles.length; i++){
I checked the path, and that exists, i even made sure that a file of the extension .info exists in that directory. What am I doing wrong?