Does anyone know how to get uri file from a self-made Eclipse plug-in?
Absolute paths will not be a problem:
URI.createFileURI("C:/Users/hp/workspace(dke)/SMartGen/StarSchema.profile.uml");
But how do I access local resources relatively?
URI.createFileURI("jar:file:/%ECLIPSE_HOME%/plugins/SMartGen.jar!StarSchema.profile.uml");
doesn't work that way ....
Happy for every answer.
lg martin
Use FileLocator .
Example:
URL iconUrl = FileLocator.find(Platform.getBundle("myBundle"), new Path("icons/someIcon.png"), null);
This will get the URL of the file "someIcon.png", which is located in the "icons" folder in the "myBundle" package.
, org.osgi.framework.Bundle.getEntry(String). java.net.URL, InputStream . , , , jar .
org.osgi.framework.Bundle.getEntry(String)
java.net.URL
InputStream
Bundle bundle = FrameworkUtil.getBundle(MyClass.class); URL url = bundle.getEntry("StarSchema.profile.uml");
URL- toURI() .
toURI()