Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7803603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:38:19+00:00 2026-06-02T01:38:19+00:00

I am using: Linux Debian 6, Java 1.6.29 and Tomcat 6 I’ve seen many

  • 0

I am using:

Linux Debian 6,
Java 1.6.29 and
Tomcat 6

I’ve seen many posts about it explaining that java.awt requires X11 libraries..etc., but they are not solving the problem.

I set -Djava.awt.headless=true in my box and I worked around the first problem of the headless environment, now I am getting:

java.awt.HeadlessException
java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
java.awt.Window.(Window.java:432)
java.awt.Frame.(Frame.java:403)
javax.swing.JFrame.(JFrame.java:202)
org.jfree.ui.ApplicationFrame.(ApplicationFrame.java:65)
...

I know by doing this I just told java that there is no monitor (and in fact running a standalone java program to check if the environment is headless it does return true). So is it anything to do with the Linux environment like setting the DISPLAY env variable?

I would appreciate your help,

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:38:22+00:00Added an answer on June 2, 2026 at 1:38 am

    Thanks for your reply.

    Since you gave me that I’ve been trying to text it. Still doesn’t work in the sense that: is now not throwing that exception anymore, but creating a blank image for some reason.

    So I went from this:

    public BarChartGenerator(org.qcri.power.ws.client.Server oServer, ServerStatistics oServerStat, List lVMs, String path) extends ApplicationFrame {
    
            System.setProperty("java.awt.headless", "true");
            boolean headless = GraphicsEnvironment.isHeadless();
            System.out.println("Headless: " + headless);
            Toolkit tk = Toolkit.getDefaultToolkit();
            tk.beep();
    
            // generate dataset
            final CategoryDataset dataset = createDataset(lVMs);
            setChart(createChart(oServer, oServerStat, lVMs, dataset));
    
            // create PNG of the chart...
            setFilename("chart_server"+oServer.getHost()+"_"+System.currentTimeMillis()+".gif");
    
            File fImageFile = new File(path+filename);
            try {
                ChartUtilities.saveChartAsPNG(fImageFile, chart, PowerInterface.CHART_WIDTH, PowerInterface.CHART_HEIGHT);
            } catch (Exception e) {
                e.printStackTrace();
            }
       }
    

    to the following (getting rid of extends ApplicationFrame) and use the example you gave me:

    public BarChartGenerator(org.qcri.power.ws.client.Server oServer, ServerStatistics oServerStat, List lVMs, String path) {
    
            System.setProperty("java.awt.headless", "true");
            boolean headless = GraphicsEnvironment.isHeadless();
            System.out.println("Headless: " + headless);
            Toolkit tk = Toolkit.getDefaultToolkit();
            tk.beep();
    
            // generate dataset
            final CategoryDataset dataset = createDataset(lVMs);
            setChart(createChart(oServer, oServerStat, lVMs, dataset));
    
            // create PNG of the chart...
            setFilename("chart_server"+oServer.getHost()+"_"+System.currentTimeMillis()+".gif");
    
            try {
                BufferedImage bufferedImage = getChart().createBufferedImage(PowerInterface.CHART_WIDTH, PowerInterface.CHART_HEIGHT);
                ImageIO.write(bufferedImage, "gif", new FileOutputStream(path+getFilename()));
            } catch (Exception e) {
                e.printStackTrace();
            }
       }
    

    in the log it complains about ImageIO.write(bufferedImage, "gif", new FileOutputStream(path+getFilename())); giving this error (while the file is there!):

    javax.imageio.IIOException: Can't create output stream!
            at javax.imageio.ImageIO.write(ImageIO.java:1560)
            at org.qcri.power.util.BarChartGenerator.<init>(BarChartGenerator.java:106)
    

    Any clue?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to fix this error that happens on Debian Linux using ssl commands with
I am trying to install Kyoto Cabinet in the Debian-Linux Server by using this
Using Python 2.5.2 and Linux Debian, I'm trying to get the content from a
I am using Debian Linux on which MySQL is installed. I can log in
I've recently compiled a simple hello world C program under Debian Linux using gcc:
I have a Spring project using log4j on Linux (Debian, Ubuntu and RHEL). Now
I think I should begin by saying that I've just installed linux(debian) in my
I'm using GNU/Emacs HEAD with the included cc-mode (c-version 5.32.2) on a GNU/Linux Debian
I am using Debian Linux and using wvdial, I am able to establish ppp
im using linux with gedit which has the wonderful habit of creating a temp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.