Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Feb 2011 02:41:52 -0500
From:      "Mikhail T." <mi+thun@aldan.algebra.com>
To:        java@FreeBSD.org
Subject:   image-manipulation in Java without X11
Message-ID:  <4D490AC0.5080905@aldan.algebra.com>

next in thread | raw e-mail | index | archive | help
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

||



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D490AC0.5080905>