|
Re: Read files from PlugIn [message #543371 is a reply to message #543324] |
Tue, 29 June 2010 09:00 |
Thomas Messages: 11 Registered: March 2010 |
Junior Member |
|
|
Hi,
you can all in the Application class:
Application.class.getResource( "log4j.properties" ) if its in the Application class package
Quote: | URL java.lang.Class.getResource(String name)
Finds a resource with a given name. The rules for searching resources associated with a given class are implemented by the defining class loader of the class. This method delegates to this object's class loader. If this object was loaded by the bootstrap class loader, the method delegates to ClassLoader.getSystemResource.
Before delegation, an absolute resource name is constructed from the given resource name using this algorithm:
If the name begins with a '/' ('\u002f'), then the absolute name of the resource is the portion of the name following the '/'.
Otherwise, the absolute name is of the following form:
modified_package_name/name
Where the modified_package_name is the package name of this object with '/' substituted for '.' ('\u002e').
Parameters:
name name of the desired resource
Returns:
A java.net.URL object or null if no resource with this name is found
Since:
JDK1.1
|
[Updated on: Tue, 29 June 2010 09:00] Report message to a moderator
|
|
|
|
Re: Read files from PlugIn [message #547640 is a reply to message #543418] |
Mon, 19 July 2010 08:55 |
budili Missing name Messages: 64 Registered: May 2010 |
Member |
|
|
Hello,
i have another question to this topic.
It is possible to get about Application.class.getResource(name) the absolute path of the files in the plugin project?
If i use
Application.class.getResource( "/log/log4j.properties" )
than i get the relative path of the file, but i need the absolute path of the file. Is this with Application.getResource possible?
Or exists therefor other mechanism?
Edit:
I have at the moment the following problems:
With Application.class.getResource i dont geht the absolute path, so i use some System property keys, for exampe "osgi.splashLocation" etc. In my development IDE all works fine, but if i deploy the application, nothing work more.
Therefore i need a mechanism, which get me always the absolute path of the plugin.
THX
[Updated on: Mon, 19 July 2010 15:19] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04581 seconds