[#11761] - Images not show in Designer Ver 6.8

Bug report
Project: Severity:
Component: Reproducibility:
Assigned to:

I have updated Jaspersoft Studio from 6.6 to 6.8 and now images are not shown in the design view. In the preview, the images are shown.
If the expression is prefixed with the source-folder (as it does with the selection dialog), the image will be shown but it will not work in the compiled .jar file.

Image icon imageselection.png80.22 KB
Jaspersoft® Studio
mwrekers's picture
Joined: Jun 23 2011 - 1:00am
Last seen: 1 year 5 months ago


Image icon designview.png49.7 KB
Image icon preview.png17.44 KB
  • Priority:Normal» High


I reproduce this bug in the last version of jasper studio 6.12.2.
There is a workaround ? When this bug will be fixed ?

  • Assigned:nobody» morlandin

Hi, I'm trying to reproduce this bug but on my side everything is working correctly on 6.12.2, I've used the same folder structure and image name and using the image selection dialog the generated expression for a workspace resource is correct ("/icons/logo/logo-fb.jpg") and the image is displayed in design mode. Are you on windows? is there some steps that could help me to reproduce?
Also try to enable the internal JSS console (preferences -> Jaspersoft Studio -> Global settings), then open the console view (window -> show view -> console) and from the console view click the down arrow at the right of the computer screen and select JSS Internal Console and look if there is an error related to the image path


Yes the logs shows an error:

Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
net.sf.jasperreports.engine.JRException: Byte data not found at: icons/logo/logo-fb.png.
at net.sf.jasperreports.repo.RepositoryUtil.getBytesFromLocation(RepositoryUtil.java:215)
at net.sf.jasperreports.renderers.util.RendererUtil.getNonLazyRenderable(RendererUtil.java:179)
at com.jaspersoft.studio.jasper.LazyImageConverter$1.run(LazyImageConverter.java:484)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Start ClassPath Mapping
Mapping: Archive: file:/C:/eclipse-oxygen/plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar
Mapping: Archive: file:/C:/Program%2520Files/Java/jre1.8.0_202/lib/rt.jar
Error constructing classpath: file:/C:/Program%2520Files/Java/jre1.8.0_202/lib/rt.jar: java.io.FileNotFoundException: C:\Program%20Files\Java\jre1.8.0_202\lib\rt.jar (Das System kann den angegebenen Pfad nicht finden)
Mapping: Directory C:\Users\mawithak.AD\workspace_oxygen\rekers\bin
Mapping: Archive: file:/K:/edv/java/prd/lib/xml-rpc/ws-commons-util.jar
..... lots of mappings .....
Mapping: Archive: file:/K:/edv/java/prd/lib/flatlaf/flatlaf-jide-oss-0.35.jar
Mapping: Archive: file:/K:/edv/java/prd/lib/flatlaf/flatlaf-swingx-0.35.jar
End ClassPath Mapping#
Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,71]
Message: found: DTD, expected START_ELEMENT or END_ELEMENT
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.nextTag(Unknown Source)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.readXML(FileDataAdapterStorage.java:263)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.readDataADapter(FileDataAdapterStorage.java:279)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.readDataADapter(FileDataAdapterStorage.java:329)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.checkFile(FileDataAdapterStorage.java:252)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.access$0(FileDataAdapterStorage.java:246)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage$ResourceVisitor.visit(FileDataAdapterStorage.java:71)
at org.eclipse.core.internal.resources.Resource.lambda$0(Resource.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90)
at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:135)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:94)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage$1.runInWorkspace(FileDataAdapterStorage.java:95)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

It may be because the source and binary files directories are ignored. (The ignoring can unfortunately also be seen in the compiled .jasper files that are created in the source directory).
The full path of the file is C:\Users\mawithak.AD\workspace_oxygen\rekers\src\icons\logo\logo-fb.png

Image icon directories.png29.93 KB

Are you using a plugin version? in case which is the base version of eclipse and did you do a clean install or an update? Can you do a test with an rcp 6.12?
Because looking at your log I see some error not realated to images that I think they could broke something in the image loading


Yes it is a plugin version.
Version: 2020-03 (4.15.0)
Build id: 20200313-1211
This version is updated from previous version of eclipse.

Testing an RCP Version is not really an option. It should also work properly as an plugin.


I've tested the plugin on your same version of eclipse and everything seems working correctly. Which version of java are you using?
Also can you try to check if this happen also on a new workspace?


We are using Java 8.

Again, it seems that the separated directories for source and binary are the problem (see directories.png attached at #5 or create_java_project.png at this comment). If I chose the .png file with the filechooser from the properites page, the expression will be "/src/icons/logo/logo-fb.png" where "/src/" is wrong because this directory is not available in the binary. If i change it to "icons/logo/logo-fb.png" it will work in the compiled jar but not in the designer.

Image icon create_java_project.png42.88 KB

Can you give a look to this screencast and tell me if I'm doing the correct steps: https://www.screencast.com/t/O5Gw9kINmVkL
As you can see I create the image in the source folder and even with /src/icons/.... it is able to read it both in the editor and in the preview. The version is a plugin 6.12.2 installed on an eclipse 4.15.0


Yes, this works in the designer and the preview, but not in the running program because the /src directory is not present. The location in the running program is /images/logo/cherry.jpg respectively as relative path images/logo/cherry.jpg not /src/images/logo/cherry.jpg


What do you mean with the running program? if I understood well you are packaging your project at jar and using it somewhere else? If this is the case it is outside the studio functionality to automatically copy stuff from a source folder to a binary folder. If when creating the report you select a resource in the workspace it use the current path of the resource. So the dialog is doing the correct thing, you are selecting a resource in a specific path and that path is used.
By the way if in the example of the screencast you change the path to "/images/logo/cherry.jpg" it works anyway both in design and preview, because JR in the last version is able to resolve it anyway. But this is something that JR does in a cascade search for the resource, but the dialog providing the selection path with the src is doing the correct thing since that is the path of the resource.


Eclipse is automatically exporting it to the binary folder if configured (See the .png at comment #5 "Standardausgabeordner"). If a binary folder is configured, all compiled binarys should be exported to this folder. This means the .jasper files should also exported to this binary folder. The java .class files are not directly next to the .java files in the src folder, they are in the bin folder.

We have 6.12.2, is this the last version that you mentioned? This version dosen't show the image if it begins with a slash without /src.
We also use JFormDesigner which has a dialog to select icons. Their dialog recognizes the src folder and selects /icons/FILENAME.png without /src.

Image icon jformdesigner.png58.56 KB
  • Resolution:Open» Works as Designed
  • Status:New» Closed

Hi, closing the bug since we are not going to modify the current behavior. In the example screencast attached by Marco he put also the reports in the src folder. That's why it was working with both a "/src/images/logo/file.png" or with a "/images/logo/file.png".
You could proceed like this, or you could properly create resource folders outside the src (source) one and just pack them during the jar export.

I got the use case you mentioned but this would open up a trouble in another scenario:
- logo.png inside MyProject/src/images/logo/mylogo.png
- logo.png inside MyProject/images/logo/mylogo.png
How should the app behave when dealing with an expression like "/images/logo/mylogo.png"?


  • Resolution:Works as Designed» Open
  • Status:Closed» New

The /images/logo directory is never present. In our scenario, there are src/images/logo and bin/images/logo directorys. During export, the bin/ prefix is removed.
It seems that you are not aware of the option to split the source- und binary-directories (as mentioned in reply #9). This would also explain why the .jasper files will be generated in the source folders and not in the binary folders.

  • Resolution:Open» Works as Designed
  • Status:New» Closed

Hi, I was referring to the use case scenario like the one attached in image "possibleProblematicUseCase.png".
Considering your observation, in such situation you will not know how to deal with a possible expression like "/images/logo/mylogo.png". Because it would not now which to take 1) the one in output binary folder 2) the one in the path starting from the current location.

Please also consider that you don't need to build a project to run a report. It's not mandatory. Therefore you could have the "bin" folder empty.
My suggestion in comment #15 was to have the resources folder outside the src one. You can later easily export it when producing a jar file: see the image "exportedJarContent.png".

About the .jasper file generation, it was like this since the beginning, for historical reasons coming from the iReport editor.
Moreover you might want to pick the the .jasper files in the proper dialog when choosing/creating a sub-report expression.


Image icon possibleproblematicusecase.png272.66 KB
Image icon exportedjarcontent.png329.59 KB
  • Resolution:Works as Designed» Open
  • Status:Closed» New

I attached my scenario, where the image is not shown.
What I can not understand that once worked in versions 6.6 and now it should no longer work.

Image icon jasperreports.png248.9 KB