Resource access

From: Peter Wilford (Peter_at_cpa-wilford.com)
Date: 03/26/04


Date: Fri, 26 Mar 2004 10:33:56 -0500

Hi All,

Hi All,

I'm having a bit of a problem accessing resources, and I am hoping
someone here can help me with it...

I am fairly 'new' to Java, so some of my assumptions "maybe/will
be/could be" wrong...

I have created a JApplet application in which I instantiate a
JToolBar. The 'gif' images used for the buttons are in a subdirectory
directly below the
directory containing the application.
C:\ --|
        |-- Dir
              |
              |-- dir
                   |
                   |-- appdir
                         |-- applet.html
                         |-- class & src files
                         |-- Images Directory
                                |
                                |-- icon.gif

When I use the 'fully qualified' image name to access them (Exp.
"C:\Dir\dir\appdir\Images"), the images are displayed correctly,
however, hardcoding a directory path is not a good thing, so I would
like to reference this directory as 'Images'.

I had 'assumed', that all directories in the "classpath", which
includs the 'current' application directory/path, were accessible, and
as such could be referenced as 'Images/icon.gif'... This doesn't seem
to be the case.

I am using the 'NetBeans IDE' using the Java 1.4.1_07 SDK, the Java
HotSpot Client VM, and the Java Web Start plugin. When I run this
application, the Web Start console initializes, and identifies an
'AccessControlException: access denied' message, furthermore it
indicates a java.io.FilePermission problem with
"C:\Dir\dir\appdir\Images\icon.gif...

As a means of 'troubleshooting', I then copied the 'appdir' and
subdirectory to my root directory, thinking it may be a permissions
problem when creating the directories and files with the same result.

Obviously it must be somthing I am or am not doing, but I am not sure
where to begin... Any suggestion?

Thanks,

Peter Wilford