LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   java works but only part with php to transform xml (https://www.linuxquestions.org/questions/programming-9/java-works-but-only-part-with-php-to-transform-xml-303439/)

richard22 03-19-2005 01:06 AM

java works but only part with php to transform xml
 
I am wanting to transform xml to pdf. This works from the command line using

java org.apache.xalan.xslt.Process -in fobar.xml -xsl foobar.xsl -outfoobar.fo

java org.apache.fop.apps.Fop -foobar.fo -pdf foobar.pdf

However when run from a script on a web page, on the same machine, using php with

exec('java org.apache.xalan.xslt.Process -in fobar.xml -xsl foobar.xsl -outfoobar.fo')

exec('java org.apache.fop.apps.Fop -foobar.fo -pdf foobar.pdf');

only the first line works. If I put the top two lines in an executable bash script and call it from the page it works but I don't want to open up the system so much.

I presume this is a question about path or classpath but have tried every variation that I can think of in bash.bashrc and profile.

Any thoughts would be appreciated - I work in php but java is actually a mystery to me.

Regards Richard

jlliagre 03-19-2005 01:46 AM

Try tracing your php program (strace -f ...) and see what happen when you run the second java command.

richard22 03-19-2005 10:18 AM

I wasn't sure how that was to be used but when 2>&1',$output applied to the line I get:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/fop/apps/Fop

hence my feeling it must be something about the path used by xwindows or apache compared to the bash shell (which works)

Regards Richard

gbonvehi 03-19-2005 06:16 PM

And what about? exec('java org.apache.xalan.xslt.Process -in fobar.xml -xsl foobar.xsl -outfoobar.fo && java org.apache.fop.apps.Fop -foobar.fo -pdf foobar.pdf');
;)

richard22 03-20-2005 10:42 PM

That doesn't work either. Using:
echo $output;
foreach($output as $outputline){
echo("$outputline<br>");
}
reveals $output to be an empty array followed by the same exception!


All times are GMT -5. The time now is 03:48 PM.