Home pageFind It!Contact PJAPJA documentation

PJA

 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject PJAImage.getGraphics() does not return

kozo

Location : Budapest
Member since : Aug 22, 2003
Messages : 2
 Aug 22, 2003 at 3:12 PM
Hi

My problem is the following:

I use PJAImage and Acme encoders in my servlet to show graphical informations using gif template.

Former it worked, but when we put it into chroot-enviroment the getGraphics() method does not answer.

Some code:

class EH {
static {
setSystemProps();
}


private static final void setSystemProps() {
System.setProperty("awt.toolkit", "com.eteks.awt.PJAToolkit");
System.setProperty("java.awt.graphicsenv", "com.eteks.java2d.PJAGraphicsEnvironment");
System.setProperty ("java2d.font.usePlatformFont", "false");
System.setProperty ("java.awt.fonts", getFontsPath());
}

private static final String getFontsPath ()
{
String fontsPath = "." + File.pathSeparator + "/usr/java/jre/lib:/usr/java/jre/lib/fonts";
//String fontsPath = "." + File.pathSeparator + "c:\\Temp\\java;C:\\winnt\\fonts";
String userDir = getSystemProperty("user.dir", null);
if (userDir != null)
fontsPath += File.pathSeparator + userDir;
String javaHome = getSystemProperty("java.home", null);
if (javaHome != null)
fontsPath += File.pathSeparator + javaHome;
return fontsPath;
}


public static String drawH() throws Exception {

...

String resFn;

String fn = JerProperties.getProperty("ImgDir");
String fSep = System.getProperty("file.separator");
fn += fSep + "nezoter_alap_" + eHID + ".gif";
JerLog.print("Nezoter pic template file = " + fn, JerLog.DEBUG_LEVEL_DEVELOP);

FileInputStream fi = new FileInputStream(fn);
JerLog.print("File Input Stream opened", JerLog.DEBUG_LEVEL_DEVELOP);

debug++;
//3
try {
fi.skip(6);
int w = fi.read();
int ch = fi.read();
w += ch *256;
int h = fi.read();
ch = fi.read();
h += ch *256;
//fi.reset();
fi.close();
JerLog.print("Nezoter pic size detected", JerLog.DEBUG_LEVEL_DEVELOP);

fi = new FileInputStream(fn);
GIFDecoder gd = new GIFDecoder(fi);
PJAImage bi = new PJAImage(gd);
Point.Double zoom = new Point.Double(w / mapsize_D.x, h / mapsize_D.y);
JerLog.print("Nezoter pic loaded", JerLog.DEBUG_LEVEL_DEVELOP);

Graphics g = bi.getGraphics(); <-- Waits here forever
JerLog.print("Nezoter graph got", JerLog.DEBUG_LEVEL_DEVELOP);

....
}

What can cause this problem?
PJA Image requests some libraries?

Thanx For Help!

Regards

---
KoZo

Manu

Location : Paris / France
Member since : Apr 29, 2003
Messages : 394
 Sep 21, 2003 at 5:53 PM
I think the image you tried to put first in the PJAImage with PJAImage bi = new PJAImage(gd);
isn't found. As getGraphics tries first to load the requested image before returning a Graphics object, it may wait for a long time if it can't load the image you requested...
---
Manu (moderator/modérateur)

kozo

Location : Budapest
Member since : Aug 22, 2003
Messages : 2
 Sep 22, 2003 at 10:12 AM
Thanx for help, but the image exists.

The problem was solved by added X libs to chroot-ed environment and
LD_LIBRARY_PATH.

Thanx again.

KoZo
---
KoZo


Home pageFind It!ContactTop

© Copyrights 1997-2023 eTeks - All rights reserved

PJAPJA documentation