在tomcat的temp文件夹中有好多图片,全是jfreechart生成的,能不让他生成文件的形式吗 
生产环境是weblogic应该也会用同样的问题 

解决方案 »

  1.   

    图片是在内存中生成的,直接获取对象getBytes[],然后用response.getOutputStream()写出去就好了
      

  2.   

    chart.toByteArray();
    调用这个方法
      

  3.   

    ChartUtilities.saveChartAsJPEG(new File("C:\\filename.jpg"), chart, 400, 300);orFileOutputStream fio = new FileOutputStream("C:\\filename.PNG");
    ChartUtilities.writeChartAsPNG(fio, chart, 400, 300,null);
    fio.flush();
    fio.close();
    其中的chart就是org.jfree.chart.JFreeChart
    ChartUtilities有很多类似saveChart* 和writeChart* 的方法。
      

  4.   

    new File("C:\\filename.jpg"), 这不就保存在硬盘了吗,几天就暴硬盘了