Here you can find the source of getResource(String path)
public static File getResource(String path)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Platform; public class Main { public static File getResource(String path) { // TODO: not nice to have the hard coded bundle name URL bundleurl = Platform.getBundle("de.schenk.jrtrace.service.test").getEntry(path); try {/*from w w w . ja v a2s . c o m*/ URL fileURL = FileLocator.toFileURL(bundleurl); return new File(fileURL.toURI()); } catch (URISyntaxException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } }