This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Author

Display image using img src tag in ubuntu

Narendra Yadava
Greenhorn

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: 14074
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display image using img src tag in ubuntu
 
Similar Threads
how to include image in JEditorPane ?
displaying image + JSP
image not displaying on page
creating image using AJAX and displaying on web page
Relative path issue with ubuntu