powered by Jive Software

External .jar dependancies and custom image resources

I am developing an experimental sparkplug that will display RSS/ATOM newsfeeds in a custom tab added to Spark. This will require custom images (the RSS logo etc.) and access to an external .jar file (ROME libraries). The images and external .jar files have been placed in the pluggin-classes.jar file (the external .jar files are at the root level and the images in a subdirectory called ‘‘images’’). I am unable to access these images and .jar files. For example when I try to load an image with the code:

ImageIcon logo = new ImageIcon(“images/rss_logo1.jpg”);


ImageIcon logo = new ImageIcon(“lib/images/rss_logo1.jpg”);

I am unable to load the image. However when I specify a full path:

ImageIcon logo = new ImageIcon(“D:/Data/My Pictures/RSS/rss_logo1.jpg”);

The image loads correctly. What is the relative path of the resources I have included in my sparkplug’'s pluggin-classes.jar file?

I also receive a ‘class not found’’ error message whenever I reference a class that is included in one of the external.jar files I have contained in my plugin-classes.jar file. How can I ensure the external .jar files I have included in the plugin-classes.jar file are on the classpath ?

I have looked through the example code, but there is no example code that performs these tasks.

Thanks in advance for your help.

  • Ken

It seems Heather had a similar issue Posted: Oct 20, 2006 4:08 PM which was answered by Ryan. I will retry my code based on the information provided there. May I suggest this technique be included in the example code for future reference.

I was able to answer my own question by searching through the Forums multiple times. The brief summary of the asnwer is:

File libDir = (new File(PluginManager.PLUGINS_DIRECTORY, pluginName

  • “/lib”)).getAbsoluteFile();

final String resourcePath = libDir.getAbsolutePath() + File.separator;

Hi Ken,

Not to dissuade you from your plans but you might be interested in looking at the RSS Sparkplug that is available on the Version 2 Software software page. The RSS reader is about as basic as it gets but it works.