# Image implementation

**URL:** <https://forum.universal-robots.com/t/image-implementation/2244>\
**Category:** Java\
**Created:** [July 4, 2018, 9:42am UTC](https://forum.universal-robots.com/t/image-implementation/2244 "2018-07-04T09:42:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon98029882](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@anon98029882](https://forum.universal-robots.com/u/anon98029882)\
**Post date:** [July 4, 2018, 9:42am UTC](https://forum.universal-robots.com/t/image-implementation/2244/1 "2018-07-04T09:42:42Z")

</div>

Hello,

I’m currently trying to implement an image into the installation tab of my urcap (UR version 5.0.3),  
whereby i followed this tutorial (using the label component variant):

> [@Showing an image in a URCap](https://forum.universal-robots.com/t/showing-an-image-in-a-urcap/20):
>
> There is two options for showing an image in PolyScope: ImgComponent - HTML5 [image] concept LabelComponent - Basically an icon + text Label component On the HTML side: \<div id="liveImageImgDiv"\>\<label id="liveImage"/\>\</div\> In the contribution class: @Label(id = "liveImage") private LabelComponent liveImage; In openView(): try{ liveImage.setImage(ImageIO.read(getClass().getResource("/com/ur/urcap/helloworld/impl/ur.png"))); } catch (java.io.IOException e) { e.printStackTrace(); …

But instead of the image showing, i get this error on startup:

![Capture](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/6e52efa229ec2e7ae8d4b6cc7b4262d049ca72ad.PNG)

This is the code i used (it is based on the mydeamon example):  
label definition: (LogoImage)  
 ![label](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/60550542ad09d5fc925fa2872d420c745aea76f8.png)

This is the openview() code:

```
@Override
	public void openView() {
	    enableDaemonButton.setText("Start Program");
		disableDaemonButton.setText("Stop Program");
		popupTitleField.setText(getPopupTitle());

		//UI updates from non-GUI threads must use EventQueue.invokeLater (or SwingUtilities.invokeLater)
		uiTimer = new Timer(true);
		uiTimer.schedule(new TimerTask() {
			@Override
			public void run() {
				EventQueue.invokeLater(new Runnable() {
					@Override
					public void run() {
						updateUI();
					}
				});
			}
		}, 0, 1000);

        try{
            LogoImage.setImage(ImageIO.read(getClass().getResource("/com/ur/urcap/examples/mydaemon/impl/logo_transparent.png")));
        }
        catch (IOException e) {
            e.printStackTrace();
        }
	}

```

Html definition:  
 ![html](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/36724d325d1b19325aa58e856b0b2603c9047d25.png)

The image shows up in the correct folder in the built urcap:

 ![Captureurcap](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/710c471fb575125da1c6136e003196de0efeda80.PNG)

But still this results in a nullpointer where it can’t locate the image.  
Am i still missing something?  
thanks in advance!

---

<div class="post-metadata">

**Author:** ![anon42905246](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@anon42905246](https://forum.universal-robots.com/u/anon42905246)\
**Post date:** [July 5, 2018, 4:30am UTC](https://forum.universal-robots.com/t/image-implementation/2244/2 "2018-07-05T04:30:07Z")

</div>

You cut off a significant part of error message window in you screenshot, I think. Are you sure the path to resource is ok?  
Try to run Polyscope in terminal and see what kind of messages pop up.  
Why not using `<img>` for image, btw?

EDIT: Ok, I think you didn’t put your image under `.../src/main/resources/com/ur/urcap/examples/mydaemon/impl/logo_transparent.png`. Am I right? You put it together with java source files. Maybe that’s the problem.
