A while back I asked about the getToolkit() problem I was experiencing with Tomcat under Solaris, Java 1.2.2. I was pointed toward eteks' PJA classes which provide a "pure" Java display substitute for XWindows. Xvfb was also suggested, which has caused many intermittent problems, so I am looking instead at PJA.
SUCCESS:
I have since installed PJA and am now starting tomcat with the PJA-specific
options added. I even suffered the "ugly fix" for the buggy sun.java2d.SunGraphicsEnvironment.class
to get it to run.
Here's my tomcat start command
$JAVACMD -Xbootclasspath/p:../pja/lib/pja.jar:../pja/lib/rtgraphics.jar
-Dawt.toolkit=com.eteks.awt.PJAToolkit -Djava2d.font.usePlatformFont=false
-Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment -Djava.awt.fonts=/usr/java1.2/jre/lib/fonts
-Duser.home=/usr/local/jakarta-tomcat-3.2.1/pja $TOMCAT_OPTS -Dtomcat.home=${TOMCAT_HOME}
org.apache.tomcat.startup.Tomcat "$@" &
The toolkit problem has disappeared. Hooray.
PROBLEM:
A new problem has appeared, in code where I am trying to create a Jpeg
output stream from an int[] buffer, using JPEGImageEncoder, which requires
creating an image and drawing it into a Graphics2d object pulled from a
BufferedImage. The following code fails at the createGraphics() line.
Image im = Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(w,
h, buffer, 0, w)); // ok
BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_BGR);
// ok
Graphics2D g = bi.createGraphics(); // dies
I have burned many hours on this so far. This only fails on Solaris - heavily and successfully tested under Windows. Does anyone have any suggestions?
Best,
Nick
PS I ran PJAToolkitDemo and successfully got the few gifs written to disk, except the ones with fonts, which failed, complaining about no .pjaf files. Not supposed to need them in Java 1.2.2... anyway...
