image-manipulation in Java without X11

Achilleas Mantzios achill at matrix.gatewaynet.com
Wed Feb 2 08:56:47 UTC 2011


try
java -Djava.awt.headless=true 

Στις Wednesday 02 February 2011 09:41:52 ο/η Mikhail T. έγραψε:
> 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
> 
> ||
> _______________________________________________
> freebsd-java at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-java
> To unsubscribe, send any mail to "freebsd-java-unsubscribe at freebsd.org"
> 



-- 
Achilleas Mantzios


More information about the freebsd-java mailing list