"headless" I think the command is.

On 1/12/06, Dakota Jack <[EMAIL PROTECTED]> wrote:
>
> You need to set a java command option so that your code won't search for a
> display.  Apparently you are using this with a server that has no monitor?
> I forget the option but look them up under the java command and it will be
> obviously.  It ends in "less" as I recall.
>
> On 1/12/06, Justin Jaynes <[EMAIL PROTECTED]> wrote:
> >
> > Hello all,
> >
> > I've written a java class to scale jpeg images.  But I can't seem to get
> > it to work.  Can anyone point me in the right direction?
> >
> > Here is my code:
> >
> >
> > package com.everybuddystree;
> >
> > import java.awt.*;
> > import java.awt.image.*;
> > import java.io.*;
> > import javax.imageio.*;
> >
> > public class ImageScaler {
> >
> > public ImageScaler() {
> > }
> >
> > public boolean scaleImageByWidth(String fileName, int newWidth) {
> >
> >   File originalImage = new File(fileName);
> >   try {
> >    BufferedImage workingBufferedImage = ImageIO.read(originalImage);
> >    int width = workingBufferedImage.getWidth();
> >    int height = workingBufferedImage.getHeight();
> >    Image workingImage = workingBufferedImage;
> >    workingImage = (Image)workingImage.getScaledInstance(newWidth,-1,1);
> >    BufferedImage finalImage = (BufferedImage)workingImage;
> >    ImageIO.write(finalImage, "jpg", originalImage);
> >
> >    return true;
> >
> >   } catch (IOException ex){
> >
> >    return false;
> >
> >   }
> >
> > }
> >
> > }
> >
> > When I run the pass an image to the class using a jsp I get the
> > following errors from Tomcat:
> >
> >
> > HTTP Status 500 -
> > ---------------------------------
> > type Exception report
> > message
> > description The server encountered an internal error () that prevented
> > it from fulfilling this request.
> > exception
> > javax.servlet.ServletException: Can't connect to X11 window server using
> > ':0.0' as the value of the DISPLAY variable.
> > org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
> > PageContextImpl.java:848)
> > org.apache.jasper.runtime.PageContextImpl.handlePageException(
> > PageContextImpl.java:781)  org.apache.jsp.image_jsp._jspService (
> > org.apache.jsp.image_jsp:158)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > org.apache.jasper.servlet.JspServletWrapper.service(
> > JspServletWrapper.java :322)
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
> > :314)  org.apache.jasper.servlet.JspServlet.service(JspServlet.java
> > :264)  javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root
> > cause
> > java.lang.InternalError: Can't connect to X11 window server using ':0.0'
> > as the value of the DISPLAY variable.
> > sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
> > sun.awt.X11GraphicsEnvironment.access$000(X11GraphicsEnvironment.java
> > :53)  sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java
> > :142)  java.security.AccessController.doPrivileged (Native Method)
> > sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java
> > :131)  java.lang.Class.forName0(Native Method)  java.lang.Class.forName(
> > Class.java:164)
> > java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(
> > GraphicsEnvironment.java:68)  sun.awt.X11.XToolkit.<clinit>(
> > XToolkit.java:96)  java.lang.Class.forName0(Native Method)
> > java.lang.Class.forName(Class.java:164)  java.awt.Toolkit$2.run(
> > Toolkit.java:821)  java.security.AccessController.doPrivileged(Native
> > Method)  java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)
> > java.awt.Image.getScaledInstance (Image.java:158)
> > com.everybuddystree.ImageScaler.scaleImageByWidth(ImageScaler.java:21)
> > org.apache.jsp.image_jsp._jspService(org.apache.jsp.image_jsp:114)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java :97)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > org.apache.jasper.servlet.JspServletWrapper.service(
> > JspServletWrapper.java:322)
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The
> > full stack trace of the root cause is available in the Apache Tomcat/5.5.12
> > logs.
> >
> > ---------------------------------
> > Apache Tomcat/5.5.12
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Yahoo! Photos – Showcase holiday pictures in hardcover
> > Photo Books. You design it and we'll bind it!
> >
>
>
>
> --
> "You can lead a horse to water but you cannot make it float on its back."
> ~Dakota Jack~
>



--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

Reply via email to