Hi everyone...
I'm making a servlet chart program using jfreechart on linux server.
(Apache, Jserv, JDK1.3.1, Oracle, ...)
And I wanna use both of Xvfb and PJA method.
After having 2 hard days, I succeeded using Xvfb method, but
the PJA method bothers me...(No Error, but No Image...T_T)
Please, Gimme a good idea...thanks
Source modifying...thanks very much...^^;
Here is some part of my test source...
--------------------------------------------------------
import Acme, eteks, jrefinery, awt, ...
...
making chart => myChart
...
try {
System.setProperty("awt.toolkit", "com.eteks.awt.PJAToolkit");
System.setProperty("awt.GraphicsEnvironment", "com.eteks.java2d.PJAGraphicsEnvironment");
System.setProperty("java.awt.fonts","/usr/X11R6/lib/X11/fonts/baekmuk");
Image image = createPJAImage(800,600);
Graphics g = image.getGraphics();
myChart.draw((Graphics2D) g, new Rectangle(800,600));
ServletOutputStream out = resp.getOutputStream();
GifEncoder encoder = new GifEncoder(image, out);
encoder.encode();
if (g != null) {
g.dispose();
}
if (frame != null) {
frame.removeNotify();
}
out.close();
return;
}
catch (Exception e) {
return;
}
}
public Image createPJAImage(int width, int height)
throws Exception
{
try {
return new PJAImage(width, height);
}
catch (LinkageError e) {
throw e;
}
}
------------------------------------------------------------
Using PJA...
RE: Using PJA...
I had success with PJA on linux using jdk 1.3
make sure you unsetenv DISPLAY before you startup your tomcat/jsp container
This is the command line I used to jvm:
TOMCAT_OPTS="-Xbootclasspath/a:/mp3/pja_2.3.1/lib/pja.jar -Dawt.toolkit=com.eteks.awt.PJAToolkit -Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment -Djava2d.font.usePlatformFont=false -Djava.awt.fonts=/usr/local/pkg/jdk1.3/jre/lib/fonts -Duser.home=.. "
You probably just need to specify the bootclasspath I'm guessing.
Sticking the font.properties into user.home/lib is important too.
Jason
make sure you unsetenv DISPLAY before you startup your tomcat/jsp container
This is the command line I used to jvm:
TOMCAT_OPTS="-Xbootclasspath/a:/mp3/pja_2.3.1/lib/pja.jar -Dawt.toolkit=com.eteks.awt.PJAToolkit -Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment -Djava2d.font.usePlatformFont=false -Djava.awt.fonts=/usr/local/pkg/jdk1.3/jre/lib/fonts -Duser.home=.. "
You probably just need to specify the bootclasspath I'm guessing.
Sticking the font.properties into user.home/lib is important too.
Jason
RE: Using PJA...
I had success with PJA on linux using jdk 1.3
make sure you unsetenv DISPLAY before you startup your tomcat/jsp container
This is the command line I used to jvm:
TOMCAT_OPTS="-Xbootclasspath/a:/mp3/pja_2.3.1/lib/pja.jar -Dawt.toolkit=com.eteks.awt.PJAToolkit -Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment -Djava2d.font.usePlatformFont=false -Djava.awt.fonts=/usr/local/pkg/jdk1.3/jre/lib/fonts -Duser.home=.. "
You probably just need to specify the bootclasspath I'm guessing.
Sticking the font.properties into user.home/lib is important too.
Jason
make sure you unsetenv DISPLAY before you startup your tomcat/jsp container
This is the command line I used to jvm:
TOMCAT_OPTS="-Xbootclasspath/a:/mp3/pja_2.3.1/lib/pja.jar -Dawt.toolkit=com.eteks.awt.PJAToolkit -Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment -Djava2d.font.usePlatformFont=false -Djava.awt.fonts=/usr/local/pkg/jdk1.3/jre/lib/fonts -Duser.home=.. "
You probably just need to specify the bootclasspath I'm guessing.
Sticking the font.properties into user.home/lib is important too.
Jason