I've run into a problem using some of the internal resources inside the
Jmol.jar for WebExport. If anybody knows what I'm doing wrong please let me
know.
Running inside Eclipse my code works.
As a compiled .jar I find that the resource URL is null instead of a usable
value.
Note it continues to work for things inside the WebExport.html part of the jar.
I assume this may have to do with the fact that WebExport is below the
resources I am trying to access in the jar structure. I have not been able to
figure out what to do. Should I be getting the URL with a call like
object.getParent...?
Here's the piece of code.
object = this (the WebExport object)
fileName = ( button.png, which works for files in WebExport.html, or
../image/button.png or org/openscience/jmol/app/images/ neither of the last two
work in the compiled .jar, but all three work in Eclipse)
flagError=True.
static URL getResource(Object object, String fileName, boolean flagError) {
URL url = null;
if (!fileName.contains("/"))fileName="html/"+fileName;
try {
if ((url = object.getClass().getResource(fileName)) == null && flagError)
System.err.println("Couldn't find file: " + fileName);
} catch (Exception e) {
System.err.println("Exception " + e.getMessage() + " in getResource "
+ fileName);
}
return url;
}
Thanks,
Jonathan
------------------------------------------------------------------------------
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers