This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Servlets and the fly likes linux server load an image from file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "linux server load an image from file" Watch "linux server load an image from file" New topic

linux server load an image from file

sunitha singh

Joined: Jun 12, 2002
Posts: 8
Hello every body.
My server is linux server(doesn't have x windows)My servlet needs to create an image(offscreen buffered image) and draw images on it reading from the files on the server.
but drawImage always returns false inspite of using mediatracker. and the images from file are never drawn.
this is the code
can some one please help me.
Toolkit toolkit = Toolkit.getDefaultToolkit();
ImageIcon icon = new ImageIcon(s);
img = icon.getImage();
Container c=new Container();
MediaTracker mt=new MediaTracker(c);
mt.addImage(img ,0);
}catch(Exception ex){ex.printStackTrace();}
bool=g.drawImage(img,30, 30,c);
how ever i try with or with out mediatracker i always get bool as false.
can some one plaesae help me.........
thanks in advance
[ September 23, 2002: Message edited by: sunitha singh ]
chanoch wiggers
Ranch Hand

Joined: May 24, 2001
Posts: 245
i'm pretty sure you have to have an x server running, even if it is in the background. YOu dont have to run a client or anything but there must be a server.

chanoch<p><a href="" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
I agree. Here's the link:
subject: linux server load an image from file
Similar Threads
Doh! How do you draw a line on an image?
Loading an Image on a headless (No XWindows) server
mmm.. music
loading images from an specific directory
saveing Graphics to files