2012-08-24 120 views
0

我想是指圖像的Eclipse插件內(如圖示),以下列方式(從教程日食FAQ網站):映像路徑

Bundle bundle = Platform.getBundle(PLUGIN_ID); 
Path path = new Path("icons/doodledebug-icon.png"); 
URL fileURL = FileLocator.find(bundle, path, null); 
URL resolved = null; 
try { 
    resolved = FileLocator.resolve(fileURL); 
} catch (IOException e) { 
    throw new RuntimeException(e); 
} 
ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(resolved); 

該作品測試時很好,即在運行時的eclipse應用程序中。但是,在創建更新站點並使用此站點時會導致錯誤。該路徑似乎是沒有語法正確:這是爲什麼斷時在一個罐子裏執行,或者我應該怎麼正確地做到這一點

C:\Program Files\eclipse EE indigo\file:\C:\Users\Me\.eclipse\org.eclipse.platform_3.7.0_1202875443\plugins\DoodleDebugServer-Plugin_1.0.0.201208241809.jar!\icons\doodledebug-icon.png

回答

1

假設圖標目錄是在項目,我相信你可以只添加斜線的路徑前面的根級:

Path path = new Path("/icons/doodledebug-icon.png"); 
+0

聖......非常感謝! –