Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using Java 2D API on Linux machine without running X, is it possible?

5 views
Skip to first unread message

Krazykuo

unread,
Jul 16, 2001, 12:59:00 PM7/16/01
to
I'm trying to do some image manipulation (mainly resizing images) in a
Linux Servlet/JSP environment, to do that I use the Java 2D API. This
works fine on my Windows development PC, but does not work on an
X-less Linux hosting platform. My hosting company is not running X
and has no plans to do so.
So my question is, it is possible to use the Java 2D API on a Linux
box without an X server running?
FYI, the exact error (on the X-less Linux machine) is as follows:
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at java.awt.Toolkit$2.run(Toolkit.java:498)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:489)

Thanks for all help in advanced,

Steve

Marco Schmidt

unread,
Jul 16, 2001, 1:06:31 PM7/16/01
to
On 16 Jul 2001 09:59:00 -0700, kraz...@hotmail.com (Krazykuo) wrote:

>I'm trying to do some image manipulation (mainly resizing images) in a
>Linux Servlet/JSP environment, to do that I use the Java 2D API. This
>works fine on my Windows development PC, but does not work on an
>X-less Linux hosting platform. My hosting company is not running X
>and has no plans to do so.
>So my question is, it is possible to use the Java 2D API on a Linux
>box without an X server running?

See www.geocities.com/marcoschmidt.geo/java-image-coding.html#X
It's more about loading images, but you may find it interesting
nonetheless.

Please regard f'up2.

Regards,
Marco
--
Java programming tips (last modified 2001-05-17):
http://jiu.sf.net/javatips.html

Torgeir Veimo

unread,
Jul 17, 2001, 3:47:21 AM7/17/01
to
This is supposed to be supported in jdk 1.4.

--
- Torgeir

Krazykuo

unread,
Jul 17, 2001, 10:21:30 PM7/17/01
to
Thanks for all the help.
I looked at:
http://www.geocities.com/marcoschmidt.geo/java-image-coding.html#X
Pretty good info. But it looks like I'm still stuck. I can't run X
or xvbf (not my servers). PJA looks great, but because I have little
control over my hosting company's servers, I cannot get it to link in
at all (PJA requires that pja.jar be added to the bootclasspath, which
is different than user specific classpath). PJA does allow you to
directly call new PJAToolkit(), but doing so eliminates the use of the
Java 2D API. So I'm back to square one.

Which leads me to this question:
How is everyone else deploying servlet/JSP applications on headless
(w/out graphics) Unix/Linux servers (without running X or xbvf) where
the application can resize and alter images.

Thanks,
Steve

FYI, the offical Sun bug is at:
http://developer.java.sun.com/developer/bugParade/bugs/4281163.html
(login required)
Under the comments section, many people are cranky about this problem.

Carsten Greiner

unread,
Sep 26, 2001, 7:59:52 AM9/26/01
to
On 16 Jul 2001 09:59:00 -0700, kraz...@hotmail.com (Krazykuo) wrote:

>I'm trying to do some image manipulation (mainly resizing images) in a
>Linux Servlet/JSP environment, to do that I use the Java 2D API. This
>works fine on my Windows development PC, but does not work on an
>X-less Linux hosting platform. My hosting company is not running X
>and has no plans to do so.
>So my question is, it is possible to use the Java 2D API on a Linux
>box without an X server running?

No.
We are doing generating images in servlet environment, too (Apache,
Jserv, RedHat Linux 6.2).
We are using java2d as well as 3rd party packages (kavasoft I think)
and this requires the X server to be running.

Btw. One needs to have the X server running prior to the start of the
java code / servlet.

So, sorry about that, but we didn't find any other solution.

Carsten.

Roger Lindsjö

unread,
Sep 26, 2001, 8:48:18 AM9/26/01
to
Carsten Greiner wrote:
>
> On 16 Jul 2001 09:59:00 -0700, kraz...@hotmail.com (Krazykuo) wrote:
>
> >I'm trying to do some image manipulation (mainly resizing images) in a
> >Linux Servlet/JSP environment, to do that I use the Java 2D API. This
> >works fine on my Windows development PC, but does not work on an
> >X-less Linux hosting platform. My hosting company is not running X
> >and has no plans to do so.
> >So my question is, it is possible to use the Java 2D API on a Linux
> >box without an X server running?
> No.
> We are doing generating images in servlet environment, too (Apache,
> Jserv, RedHat Linux 6.2).
> We are using java2d as well as 3rd party packages (kavasoft I think)
> and this requires the X server to be running.
>
> Btw. One needs to have the X server running prior to the start of the
> java code / servlet.

You could run a virtual frame buffer (Xvfb).

Roger Lindsjö

Christian Mallwitz

unread,
Sep 26, 2001, 8:56:04 AM9/26/01
to

Torgeir Veimo

unread,
Sep 26, 2001, 10:50:59 AM9/26/01
to

Also, headless rendering in unix is supported in jdk1.4.

--
- Torgeir

0 new messages