Recently, because of writing a thing, save the configuration in XML, how can I find XML? Is a problem?
I saw JWHICH and wrote a small function of looking for a resource file path. (I don't know if it is right, if there is wrong, please point out)
/ **
* If you can't find it, return NULL.
* @Param SResourceName
* @Return
* /
Public Static String getResourceFilePath (String SResourceName)
{
IF (! SResourceName.startSwith ("/"))
{
SResourceName = "/" SResourceName;
}
Java.net.url ClassURL = jwhichutil.class.getResource (SResourceName);
IF (ClassURL == Null)
{
System.out.println ("/ NResource '" SResourceName "NOT Found In / N'"
System.getProperty ("java.class.path") "'");
Return NULL;
}
Else
{
System.out.println ("/ NResource '" SResourceName "' Found In / N '" ClassURL.GetFile () "');
Return Classurl.getFile ();
}
}