File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Display image using img src tag in ubuntu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Display image using img src tag in ubuntu" Watch "Display image using img src tag in ubuntu" New topic

Display image using img src tag in ubuntu

Narendra Yadava

Joined: Mar 04, 2013
Posts: 2
Hello Friends

<img src="/home/erp/iimage1.png" />

I am unable to display above image in the jsp.I have provided 777 permission to this image but image is not displaying. I am using ubuntu OS.But in windows when we provide hard path like <img src="c:/erp/iimage1.png" />then it is working fine.

Please Any can help me about it

Thanks in Advance

Narendra Yadava
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15081

The value of the src attribute is really an URL, not just a path name. You could try specifying a file URL:

<img src="file:///home/erp/iimage1.png" />

But really, what you're trying to do is a bit strange, some people would even call it wrong. You're making the browser look for an image file on the local harddisk. If you browse to the webpage from an arbitrary other client computer, the browser will try to find the image on the local harddisk of that client computer, not on the server. Why would you want to do that?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: Display image using img src tag in ubuntu
jQuery in Action, 3rd edition