You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Brian Mackey <ma...@gmail.com> on 2009/12/18 18:27:31 UTC

fop.bat bug

I just blew out about 4 hours trying to get fop.bat to run in the
command prompt programmatically in windows.  Turns out that the
problem was the fop.bat file itself. It references a file "fop.xconf"
by appending current directory + "\conf\fop.xconf".  This turns out to
be a programming killing feature when you try to run fop.bat using a
Process object in C#.


#Steps to reproduce the bug
1.  In Windows XP open the command prompt (cmd.exe).
2.  Pay attention to the current directory.  (In my case its
C:\Documents and Settings\bmackey\)
3.  Paste the following string:  "C:\Program
Files\Altova\FOP-0.95\fop.bat" -fo
C:\StyleVisionTestRC\workaround\1.fo -pdf
C:\StyleVisionTestRC\workaround\1.pdf
   (Where the fo file is a valid fo file that you happen to have and
the pdf directory is valid)
4.  Hit enter to run the program.
5.  You will get a usage error.  Scroll down to find the exception:
"SEVERE: Exception java.io.FileNotFoundException: C:\Documents and
Settings\bmackey\conf\fop.xconf (The system cannot find the path
specified)"
6.  Pay attention to the directory where its looking.  It is looking
at the current directory + "\conf\fop.xconf".  Woops.


#Workaround
1.  In Windows XP open the command prompt (cmd.exe).
2.  change the directory with "cd C:\Program Files\Altova\FOP-0.95" (no quotes)
3.  Paste the following string:  "fop.bat -fo
C:\StyleVisionTestRC\workaround\1.fo -pdf
C:\StyleVisionTestRC\workaround\1.pdf"  (no quotes needed unless your
arguments contain a space)
4.  Hit enter to turn the program.  Done.

I'm not a batch file programmer, but glancing at fop.bat, the last line:
"%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%"
org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS% -c conf/fop.xconf
 %LOCALCLASSPATH% is likely the issue.

Re: fop.bat bug

Posted by Brian Mackey <ma...@gmail.com>.
I assumed fop-users would not be appropriate because I felt this was a
code issue.  Though, as you have explained this bug was introduced by
Altova and I much appreciate your explanation.  I'll re-direct the
problem to them.

On Fri, Dec 18, 2009 at 12:40 PM, Simon Pepping <sp...@leverkruid.eu> wrote:
> Brian,
>
> Why do you not write about this issue to the fop-users list? This is
> not really a development issue.
>
> On Fri, Dec 18, 2009 at 11:27:31AM -0600, Brian Mackey wrote:
>>
>> I'm not a batch file programmer, but glancing at fop.bat, the last line:
>> "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%"
>> org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS% -c conf/fop.xconf
>>  %LOCALCLASSPATH% is likely the issue.
>
> The FOP distributed batch file fop.bat does not write that line. It
> writes: "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp
> "%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main
> %FOP_CMD_LINE_ARGS%. It seems you obtained FOP from Altova, and
> apparently they changed the batch file.
>
> Your quoted command line indeed references a file conf\fop.xconf
> relative to the current working directory, and FOP duely reports when
> it cannot find that file.
>
> Your workaround suggests that that file exists in C:\Program
> Files\Altova\FOP-0.95. In FOP's own batch file the environment
> variable LOCAL_FOP_HOME refers to that directory (more precisely, the
> directory of fop.bat). If one writes -c
> %LOCAL_FOP_HOME%conf/fop.xconf, then the batch file might work from
> any working directory.
>
> Regards, Simon
>
> --
> Simon Pepping
> home page: http://www.leverkruid.eu
>

Re: fop.bat bug

Posted by Brian Mackey <ma...@gmail.com>.
I assumed fop-users would not be appropriate because I felt this was a
code issue.  Though, as you have explained this bug was introduced by
Altova and I much appreciate your explanation.  I'll re-direct the
problem to them.

On Fri, Dec 18, 2009 at 12:40 PM, Simon Pepping <sp...@leverkruid.eu> wrote:
> Brian,
>
> Why do you not write about this issue to the fop-users list? This is
> not really a development issue.
>
> On Fri, Dec 18, 2009 at 11:27:31AM -0600, Brian Mackey wrote:
>>
>> I'm not a batch file programmer, but glancing at fop.bat, the last line:
>> "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%"
>> org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS% -c conf/fop.xconf
>>  %LOCALCLASSPATH% is likely the issue.
>
> The FOP distributed batch file fop.bat does not write that line. It
> writes: "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp
> "%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main
> %FOP_CMD_LINE_ARGS%. It seems you obtained FOP from Altova, and
> apparently they changed the batch file.
>
> Your quoted command line indeed references a file conf\fop.xconf
> relative to the current working directory, and FOP duely reports when
> it cannot find that file.
>
> Your workaround suggests that that file exists in C:\Program
> Files\Altova\FOP-0.95. In FOP's own batch file the environment
> variable LOCAL_FOP_HOME refers to that directory (more precisely, the
> directory of fop.bat). If one writes -c
> %LOCAL_FOP_HOME%conf/fop.xconf, then the batch file might work from
> any working directory.
>
> Regards, Simon
>
> --
> Simon Pepping
> home page: http://www.leverkruid.eu
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: fop.bat bug

Posted by Simon Pepping <sp...@leverkruid.eu>.
Brian,

Why do you not write about this issue to the fop-users list? This is
not really a development issue.

On Fri, Dec 18, 2009 at 11:27:31AM -0600, Brian Mackey wrote:
> 
> I'm not a batch file programmer, but glancing at fop.bat, the last line:
> "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%"
> org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS% -c conf/fop.xconf
>  %LOCALCLASSPATH% is likely the issue.

The FOP distributed batch file fop.bat does not write that line. It
writes: "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp
"%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main
%FOP_CMD_LINE_ARGS%. It seems you obtained FOP from Altova, and
apparently they changed the batch file.

Your quoted command line indeed references a file conf\fop.xconf
relative to the current working directory, and FOP duely reports when
it cannot find that file.

Your workaround suggests that that file exists in C:\Program
Files\Altova\FOP-0.95. In FOP's own batch file the environment
variable LOCAL_FOP_HOME refers to that directory (more precisely, the
directory of fop.bat). If one writes -c
%LOCAL_FOP_HOME%conf/fop.xconf, then the batch file might work from
any working directory.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

Re: fop.bat bug

Posted by Simon Pepping <sp...@leverkruid.eu>.
Brian,

Why do you not write about this issue to the fop-users list? This is
not really a development issue.

On Fri, Dec 18, 2009 at 11:27:31AM -0600, Brian Mackey wrote:
> 
> I'm not a batch file programmer, but glancing at fop.bat, the last line:
> "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%"
> org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS% -c conf/fop.xconf
>  %LOCALCLASSPATH% is likely the issue.

The FOP distributed batch file fop.bat does not write that line. It
writes: "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp
"%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main
%FOP_CMD_LINE_ARGS%. It seems you obtained FOP from Altova, and
apparently they changed the batch file.

Your quoted command line indeed references a file conf\fop.xconf
relative to the current working directory, and FOP duely reports when
it cannot find that file.

Your workaround suggests that that file exists in C:\Program
Files\Altova\FOP-0.95. In FOP's own batch file the environment
variable LOCAL_FOP_HOME refers to that directory (more precisely, the
directory of fop.bat). If one writes -c
%LOCAL_FOP_HOME%conf/fop.xconf, then the batch file might work from
any working directory.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org