CommandLineStarter is, if I'm not mistaken, part of the FOP standalone program, so 
you're not supposed to use it to embed FOP in your applications.  There are 
instructions on how to embed FOP on the FOP website, so you should check those.  If 
launching FOP via its standalone command line implementation is the only way you can 
do it, you need to have your runtime spawn it as an external process via one of the 
Runtime.exec() methods.

-----Original Message-----
From: Juergen Lippold [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 9:45 AM
To: <
Subject: close the Stream in the CommandLineStarter


I am trying to include the FOP-Framework into a Java-Environment and to start the 
conversion inline. But the System.exit exits the whole application. Is there a way to 
have a java Program starting FOP-Konversion not from the CommandLine?

in the class org.apache.fop.apps.CommandLineStarter there is a 
in the run-method, why ?
Is it a problem to add a FileOutputStream and to close the stream in the finally 
method instead of using the exit?

Thanks for help 
Juergen Lippold

public void run() throws FOPException {
        String version = Version.getVersion();;

        XMLReader parser = inputHandler.getParser();

        Driver driver = new Driver();

        if (errorDump) {

        FileOutputStream fos = null;
        try {
            //driver.setOutputStream( new FileOutputStream(
            //                          commandLineOptions.getOutputFile()));
            fos = new FileOutputStream(commandLineOptions.getOutputFile());
            driver.render(parser, inputHandler.getInputSource());
            //System.exit(0);   Do not stop here in the finally part the file will be 
        } catch (Exception e) {
            if (e instanceof FOPException) {
                throw (FOPException) e;
            throw new FOPException(e);
        finally {
          try {
            if (fos != null) fos.close();     // closing the stream
          catch (IOException e) {
            throw new FOPException(e);

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to