Hello out there,
I generated a nice report with iReport and now
I want to use a litte java program to generate reports in "batch" on a linux server. I
coded this little piece of snippet:
import net.sf.jasperreports.engine.*;
import java.util.HashMap;
public class runReport
{
public static void main(String[] args)
{
JasperReport jasperReport;
JasperPrint jasperPrint;
try
{
jasperReport = JasperCompileManager.compileReport(
"../hrmodul/Jobs.jrxml");
jasperPrint = JasperFillManager.fillReport(
jasperReport, new HashMap(), new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(
jasperPrint, "../hrmodul/simple_report.pdf");
}
catch (JRException e)
{
e.printStackTrace();
}
}
}
And there is the problem, it throws me an exception in line with the FillManager:
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:175)
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java:180)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:91)
at net.sf.jasperreports.engine.util.JRGraphEnvInitializer.initializeGraphEnv(JRGraphEnvInitializer.java:58)
and so on...
What is this? I don't want to SHOW the report.
Many thanks.
Frank
I generated a nice report with iReport and now
I want to use a litte java program to generate reports in "batch" on a linux server. I
coded this little piece of snippet:
import net.sf.jasperreports.engine.*;
import java.util.HashMap;
public class runReport
{
public static void main(String[] args)
{
JasperReport jasperReport;
JasperPrint jasperPrint;
try
{
jasperReport = JasperCompileManager.compileReport(
"../hrmodul/Jobs.jrxml");
jasperPrint = JasperFillManager.fillReport(
jasperReport, new HashMap(), new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(
jasperPrint, "../hrmodul/simple_report.pdf");
}
catch (JRException e)
{
e.printStackTrace();
}
}
}
And there is the problem, it throws me an exception in line with the FillManager:
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:175)
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java:180)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:91)
at net.sf.jasperreports.engine.util.JRGraphEnvInitializer.initializeGraphEnv(JRGraphEnvInitializer.java:58)
and so on...
What is this? I don't want to SHOW the report.
Many thanks.
Frank
3 Answers:
Posted on August 28, 2006 at 11:06am
Hi,
Even if you are not showing the report, JR would still use AWT to do the layout and calculations and needs fonts metrics and staff.
So you either install and X-server or use JDK with the -Djava.awt.headless=true option (requires JDK > 1.4) or use other solutions such as Xvfb or PJA.
I hope this helps.
Teodor
Even if you are not showing the report, JR would still use AWT to do the layout and calculations and needs fonts metrics and staff.
So you either install and X-server or use JDK with the -Djava.awt.headless=true option (requires JDK > 1.4) or use other solutions such as Xvfb or PJA.
I hope this helps.
Teodor
Posted on August 28, 2006 at 4:15pm
The -djava.awt.headless=true option still uses the X11 libraries, it just doesn't require a running X server. The end results are the same
No bad effects that I have encountered. I imagine it uses a bit more memory, since the font metrics, etc are loaded into it via the Xlib instead of being retained on the X server. Just a guess though.
-Barry
No bad effects that I have encountered. I imagine it uses a bit more memory, since the font metrics, etc are loaded into it via the Xlib instead of being retained on the X server. Just a guess though.
-Barry