You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Rick Roen <Ri...@LakeValleySeed.com> on 2006/06/01 17:41:54 UTC

running FOP.bat from another folder

FOP 0.92 XP Pro Java 1.5.0_6

 

I'm trying to run the FOP batch file to create pdf from a folder other than
the ..\FOP folder where the other fop files are located.

 

My batch file is below.  I have hard-coded some of the input variables to
limit errors, but I get 

 "Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/fop/cli/Main", which I think means it can't find the fop.jar
file.

 

I change the current folder with "cd %local_fop_home% thinking that this
will start things in the right folder, but no joy.

 

When I run this batch file from the FOP folder, it works ok.

 

Can anyone tell me what I am doing wrong?

 

Rick

 

 

 

 

@echo off

set FOP_FILE=%1

set XML_FILE=%2

set XSL_FILE=%3

set PDF_FILE=%4

set ERR_FILE=%5

 

set LOCAL_FOP_HOME=C:\DELPHI~1\LVSPRO~1\SEEDPA~1\FOP

 

set LIBDIR=%LOCAL_FOP_HOME%\lib

cd %local_fop_home%

 

set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-sandbox.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-hyph.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis-1.3.02.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.7.1.jar

rem set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\Saxon8.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\Saxon8-dom.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\serializer-2.7.0.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik-all-1.6.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xmlgraphics-commons-1.0.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-4.2.0.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-1.1.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-logging-1.0.4.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_codec.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\fop-hyph.jar

set LOCALCLASSPATH=%LOCALCLASSPATH%;%FOP_HYPHENATION_PATH%

 

rem need to use Saxon8 so we can do a XSLT2.0 transform on the xml

rem include Saxon8.jar and Saxon8-dom.jar in the classpath and put in
FOP\lib folder

rem also use the -Djavax... to assign the TransformerFactory to Saxon below

 

java -cp "%LOCALCLASSPATH%"
-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl


org.apache.fop.cli.Main -xml %tmp%\primavera\test.xml -xsl
%tmp%\primavera\test.xsl -pdf  %tmp%\primavera\test.pdf

 

pause


Re: running FOP.bat from another folder

Posted by Roland Neilands <rn...@pulsemining.com.au>.
Rick,

I don't think you need to cd, just run it with it's absolute path name 
or add the dir it's in to your %PATH%.

A bit of code from the one I use, the comments may help you (XP is NT). 
I commented them because my fop.bat is not in the FOP install directory:
set LOCAL_FOP_HOME=C:\fop\fop-0.20.5
rem %~dp0 is the expanded pathname of the current script under NT
rem if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME=%~dp0

NB the .bat is much more flexible if you leave the  %1 %2 %3 %4 %5 %6 %7 
%8 in the java command.

Regards,
Roland


Rick Roen wrote:
>
> FOP 0.92 XP Pro Java 1.5.0_6
>
>  
>
> I’m trying to run the FOP batch file to create pdf from a folder other 
> than the ..\FOP folder where the other fop files are located.
>
>  
>
> My batch file is below.  I have hard-coded some of the input variables 
> to limit errors, but I get
>
>  “Exception in thread "main" java.lang.NoClassDefFoundError: 
> org/apache/fop/cli/Main”, which I think means it can’t find the 
> fop.jar file.
>
>  
>
> I change the current folder with “cd %local_fop_home% thinking that 
> this will start things in the right folder, but no joy.
>
>  
>
> When I run this batch file from the FOP folder, it works ok.
>
>  
>
> Can anyone tell me what I am doing wrong?
>
>  
>
> Rick
>
>  
>
>  
>
>  
>
>  
>
> @echo off
>
> set FOP_FILE=%1
>
> set XML_FILE=%2
>
> set XSL_FILE=%3
>
> set PDF_FILE=%4
>
> set ERR_FILE=%5
>
>  
>
> set LOCAL_FOP_HOME=C:\DELPHI~1\LVSPRO~1\SEEDPA~1\FOP
>
>  
>
> set LIBDIR=%LOCAL_FOP_HOME%\lib
>
> cd %local_fop_home%
>
>  
>
> set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-sandbox.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-hyph.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis-1.3.02.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.7.1.jar
>
> rem set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\Saxon8.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\Saxon8-dom.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\serializer-2.7.0.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik-all-1.6.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xmlgraphics-commons-1.0.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-4.2.0.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-1.1.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-logging-1.0.4.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_codec.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\fop-hyph.jar
>
> set LOCALCLASSPATH=%LOCALCLASSPATH%;%FOP_HYPHENATION_PATH%
>
>  
>
> rem need to use Saxon8 so we can do a XSLT2.0 transform on the xml
>
> rem include Saxon8.jar and Saxon8-dom.jar in the classpath and put in 
> FOP\lib folder
>
> rem also use the -Djavax... to assign the TransformerFactory to Saxon 
> below
>
>  
>
> java -cp "%LOCALCLASSPATH%" 
> -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl 
>  
>
> org.apache.fop.cli.Main -xml %tmp%\primavera\test.xml -xsl 
> %tmp%\primavera\test.xsl -pdf  %tmp%\primavera\test.pdf
>
>  
>
> pause
>

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