From owner-freebsd-java@FreeBSD.ORG Wed Feb 2 08:10:05 2011 Return-Path: Delivered-To: java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CA70106564A for ; Wed, 2 Feb 2011 08:10:05 +0000 (UTC) (envelope-from mi+thun@aldan.algebra.com) Received: from smtp02.lnh.mail.rcn.net (smtp02.lnh.mail.rcn.net [207.172.157.102]) by mx1.freebsd.org (Postfix) with ESMTP id 31D188FC15 for ; Wed, 2 Feb 2011 08:10:04 +0000 (UTC) Received: from mr17.lnh.mail.rcn.net ([207.172.157.37]) by smtp02.lnh.mail.rcn.net with ESMTP; 02 Feb 2011 02:41:55 -0500 Received: from smtp01.lnh.mail.rcn.net (smtp01.lnh.mail.rcn.net [207.172.4.11]) by mr17.lnh.mail.rcn.net (MOS 4.1.9-GA) with ESMTP id ASD58428; Wed, 2 Feb 2011 02:41:54 -0500 X-Auth-ID: anat Received: from 209-6-61-133.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com (HELO [192.168.1.8]) ([209.6.61.133]) by smtp01.lnh.mail.rcn.net with ESMTP; 02 Feb 2011 02:41:55 -0500 Message-ID: <4D490AC0.5080905@aldan.algebra.com> Date: Wed, 02 Feb 2011 02:41:52 -0500 From: "Mikhail T." User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; uk-UA; rv:1.9.2.12) Gecko/20101114 Thunderbird/3.1.6 MIME-Version: 1.0 To: java@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: image-manipulation in Java without X11 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2011 08:10:05 -0000 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.(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 ||