• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Graphics object under Linux

 
Alex Iordache
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use a servlet for generating images and I have this problem: under Linux RedHat I cannot obtain a Graphics object to be used for drawing into it because (I think) the system doesn't allow me to do so as long as the X environment isn't running.
What I tried:
myClass extends Canvas{
.... Graphics g = this.createImage(w,h).getGraphics()
}
and:
...Graphics g = this.getToolkit().createImage(w,h).getGraphics()
Any suggestions ?
Thanks a lot.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Alex,
Yes. I had the same problem with SuSE Linux: No Graphics unless the X environment is running.
It makes perfect sense I thought.

Bye,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17993
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
X provides the graphics support environment such as fonts, metrics and other hardware-dependent stuff. Java doesn't support the situation where pure bitmap operations are done without reference to a graphics environment.
For all I know there might be something out there that does the same thing as having X running, but I don't know of one, and it's probably safer to just use X, since the installed user base is larger.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17993
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim Holloway:
X provides the graphics support environment such as fonts, metrics and other hardware-dependent stuff. Java doesn't support the situation where pure bitmap operations are done without reference to a graphics environment.
For all I know there might be something out there that does the same thing as having X running, but I don't know of one, and it's probably safer to just use X, since the installed user base is larger.

The real pain is that X needs to be started BEFORE your appserver starts doing graphics. This may require tweaking task start order.
 
Alex Iordache
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all. I found the answer:
1.There is a pseudo Xserver which should be started first or,
2.A package named 'PJA Toolkit' does exaclty what I need: replace awt.Image package with theirs and is under GNU License.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic