I created a desktop app and I have run into a problem with my generated runnable jar. Everything works fine in the Eclipse environment, but when I generate the jar it only shows theswt
components (menu, tabs, etc..).
The other libraries location is a blank area (library to generate gallery). The same does not appearset ToolBar
(containing buttons with images),GoogleMap.html
does not appear.
How can I correctly generate an executable jar that will include these external sources?
ToolBar image loading code :
folderSearchIcon = new Image(display, this.getClass().getResourceAsStream("images/search_folder.png"));
GoogleMap.html loading code :
File mapFile = new File("resources/GoogleMap.html");
if(!mapFile.exists()) {
System.out.println("File doesn't exist! " + mapFile.getAbsolutePath());
return;
}
Generating runnable jar:
My app structure in Eclipse and generated jar structure:
Generated manifest :
Manifest-Version: 1.0
Rsrc-Class-Path: ./ swt.jar commons-imaging-1.0-SNAPSHOT.jar org.eclip
se.nebula.widgets.gallery_0.5.3.201210262156.jar xmpcore.jar metadata
-extractor-2.6.3.jar
Class-Path: .
Rsrc-Main-Class: geotagger.AppInit
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
lib
folder is not included in the jar right? Just add them to Build Path using Eclipse – Skuldlib
folder to Eclipse project folder and next I chooseBuild Path -> Add to Build Path
for each library – Norgeresources
folder, but you use it to access the.html
file. – Ailanthuslib
folder and outside in Eclipse? – SkuldYourClass.class.getClassLoader.getResourceAsStream("images/search_folder.png");
instead? – Ailanthus