Linux上的java JFreeChart没有X AWTError:无法连接到X11窗口服务器
当我在VPS(虚拟专用服务器)中执行此代码时:
SortedSet<Integer> keys = new TreeSet<>(map.keySet());
DefaultCategoryDataset dateset = new DefaultCategoryDataset();
for (Integer hour : keys) {
dateset.addValue(map.get(hour), "", hour);
}
JFreeChart chart = ChartFactory.createLineChart("Channel: ",
"Hour", "Person", dateset, PlotOrientation.VERTICAL, false, false, false);
int width = 600; /* Width of the image */
int height = 480; /* Height of the image */
File lineChart = new File(channel_id + "_Chart.jpeg");
try {
ChartUtilities.saveChartAsJPEG(lineChart, chart, width, height);
} catch (IOException ex) {
App.sendLogger(ActivityCharts.class, "Error...
}
my xshell显示此错误:
Failed to execute Xmanager:
以及:
Exception in thread "pool-2-thread-2" java.awt.AWTError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
一致:
JFreeChart chart = ChartFactory.createLineChart("Channel: ",
"Hour", "Person", dateset, PlotOrientation.VERTICAL, false, false, false);
但当我在电脑上启动这个程序时,一切都正常
共 (0) 个答案