Hi,
I am doing the URLyBird assignment right now, and I have these instructions:
"All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory."
and
..."you must provide either a single plain ASCII (not
word processor format) text document, which must be called userguide.txt"...
Now, if I understood correctly, the "working directory" is from where the
java -jar ... command is executed. So that means if my jar is in directory X, and the user starts it from directory Y, then the "working directory" is Y. Am I right on this?
However, I do not really know what they will do with the userguide.txt file. I have to include it beside the jar, but can I make any assumptions about where it will be when my application is run? Can I assume that it will be in the same directory as the jar? I am asking this because I plan to make it available from the GUI as well (display it in a JTextArea).
Assuming the file will be in the same directory as the jar file, I still have to know which directory it is. Is there a way to determine in what directory the jar file is? new File(".") returns the working directory, so that does not work. I have had a look at the system properties, and I have found that "java.class.path" is always the path of my jar file. Can I depend on it being always so? At least -- can I assume that (if there are other files/directories there; even if I could not "add" anything there, even by using the -cp option) my jar file is always in it, and preferrable in the first place?
I was also thinking about including the file in the jar as well. Though it would be duplication, it is possibly not a big deal. What do you think?
Thanks,
David