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.

Reply via email to