image-manipulation in Java without X11
Mikhail T.
mi+thun at aldan.algebra.com
Wed Feb 2 08:10:05 UTC 2011
Hello!
I'm trying to port a Java-application, which sometimes needs to process
(get dimensions, possibly -- resize) a few images. Whenever it does
this, it needs a valid $DISPLAY in the environment, otherwise an
exception like this is thrown:
|java.lang.InternalError: Can't connect to X11 window server using
':0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at
sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52)
at
sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155)
at java.security.AccessController.doPrivileged(Native Method)
at
sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
at
java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1135)
|
Apparently, the first thing AWT is doing is initialize X11 -- even if it
is not going to need X11 for anything... This makes the program (almost)
unusable as a daemon...
I wonder if it is possible to a) make AWT a little smarter in this
regard -- even if only on FreeBSD; or b) do image-processing in Java
using some other classes?..
Thanks! Yours,
-mi
||
More information about the freebsd-java
mailing list