作者globem (hope)
看板java
标题[问题] 在Linux上将BufferedImage储存成JPEG图档
时间Thu Jun 7 18:57:09 2007
之前我为了一个网页系统写了一只画图程式
但为了让它可以在server上执行时可以将显示画面另存成图档
好让使用者可以存取
所以我把它改成用BufferedImage
好不容易改成功了.在windows上可以成功执行
可是当我拿到Linux Server上测试的时候
它却出现以下错误讯息
Exception in thread "main" 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.<clinit>(X11GraphicsEnvironment.java:1
34)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvi
ronment.java:62)
at java.awt.Window.init(Window.java:231)
at java.awt.Window.<init>(Window.java:275)
at java.awt.Frame.<init>(Frame.java:401)
at EntropyPlot.<init>(EntropyPlot.java:40)
at EntropyPlot.main(EntropyPlot.java:349)
看来好像是作业系统不同的问题
是因为我有用到BufferedImage.Graphics.Frame.Panel的关系吗
请问这有什麽方法可以解决吗?
因为我後来是着把Frame.Panel拿掉还是不行
还有我是用下面这个方法储存图档的
FileOutputStream out = new FileOutputStream("C://Post.jpg");
com.sun.image.codec.jpeg.JPEGImageEncoder encoder =
com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder(out);
encoder.encode(image);
out.close();
谢谢
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 163.25.101.155