I have source code:
private Image getImage(String path, ClassLoader loader) {
InputStream image = null;
try {
image = loader.getResourceAsStream(path);
return new Image(PlatformUI.getWorkbench().getDisplay(), image);
} finally {
if (image != null) {
try {
image.close();
}
catch (IOException e) {
//OK
}
}
}
}
On my computer this code works perfect. But, on virtual machine line:
loader.getResourceAsStream(path);
always returns null. Why?
EDIT:
Path is a relative path. For example: icons/tools/device.png. Application which I develop contains more than ten projects. I use Eclipse IDE. All projects have structure:
- com.pkg.name - folder with classes icons
- folder with icons and others files
Jar files have this structure too.
On my computer applications works perfect. On virtual machine (Windows Server(64-bit)) application can't loads images from Jar file.