A resource is a file or other fixed data that an application may access. Resources are part of the application and are shipped with it, but are stored in external files. Examples are images, sounds, and translation (localization) of messages. In the Java world a resource is commonly bundled in the same jar file as the application itself.
Syntax: resource-url resource-name
Returns a
URLPathyou can use as aURL, or you can pass to itopen-input-fileto read the resource data. Theresource-nameis a string which is passed to theClassLoaderof the containing module. If the module class is in a jar file, things will magically work if the resource is in the same jar file, andresource-nameis a filename relative to the module class in the jar. If the module is immediately evaluated, theresource-nameis resolved against the location of the module source file.
Evaluates to a special URI that can be used to access resources relative to the class of the containing module. The URI has the form
"class-resource://in compiled code, to allow moving the classes/jars. The currentCurrentClass/"ClassLoaderis associated with the URI, so accessing resources using the URI will use thatClassLoader. Therefore you should not create a"class-resource:"URI except by using this function orresolve-uri, since that might try to use the wrongClassLoader.The macro
resource-urlworks by usingmodule-uriand resolving that to a normalURL.
Evaluates to the containing module class, as a
java.lang.Classinstance.