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 lmhelp <lm...@wanadoo.fr> on 2009/05/04 17:38:17 UTC
Fop in Java and Eclipse
Hi everyone,
Thank you for reading my post.
Do you know about the following directory:
> "fop_0.95\examples\embedding\java\embedding"
>
in which one can find the following file:
> "ExampleXML2PDF.java" ?
>
This program allows to compute a ".pdf" file
given a ".xml" data file and a ".xsl" stylesheet.
I copied "ExampleXML2PDF.java" stricto (with no modifications)
to the "src/my_package_name" Eclipse folder
("my_package_name" is a Java package I created).
I launched it and it worked:
the ".pdf" file was correctly created.
Now, "ExampleXML2PDF.java" contains a class "ExampleXML2PDF"
which contains the "main" method (only). Everything is done
in that method.
[I wanted a "real" class with no "main" method]
I created a new Java class "XmlToPdfFactory"
and a new method "createPdfFile()" inside of
it.
Then, I copied stricto the contents of the "main"
method into "createPdfFile()".
After doing that, I created (in a method of another class)
an instance of the "XmlToPdfFactory" and sent the
"createPdfFile()" message to this new object:
> XmlToPdfFactory xmlToPdfFactoryObj = new XmlToPdfFactory();
> xmlToPdfFactoryObj.createPdfFile();
>
I get the following error:
> java.io.FileNotFoundException:
> C:\Program Files\java\eclipse\WebContent\xml\xslt\projectteam2fo.xsl
> (The system cannot find the path specified)
>
And this is true, there is no "WebContent\xml\xslt\projectteam2fo.xsl"
in "C:\Program Files\java\eclipse\".
"WebContent\xml\xslt\projectteam2fo.xsl" exists but somewhere else...
I hope this problem is relevant here.
Thanks in advance for your help,
--
Lmhelp
--
View this message in context: http://www.nabble.com/Fop-in-Java-and-Eclipse-tp23370964p23370964.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Fop in Java and Eclipse
Posted by lmhelp <lm...@wanadoo.fr>.
Well, here it is.
I really do not know if it's a bad or a good practice
nor what are the possible damaging consequences of it
but I changed the value of the "user.dir" (user's current
working directory) property of the "System" class to
the root of my Eclipse project:
> Let us say for instance that the root of my Eclipse project is:
> "C:\foo\bar\myEclipseProject\"
>
> I added to my program the following line:
> System.setProperty("user.dir", "C:\\foo\\bar\\myEclipseProject");
>
And the program does what it is supposed to do... (generate at
the desired place the pdf file corresponding to a given (xml, xsl)
pair of files thanks to the fop processor).
Thanks for reading,
--
Lmhelp
--
View this message in context: http://www.nabble.com/Fop-in-Java-and-Eclipse-tp23370964p23387748.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Fop in Java and Eclipse
Posted by lmhelp <lm...@wanadoo.fr>.
Hi again,
Apparently it wasn't the right place where to post my previous post... :-(
The problem is a Java, Eclipse related problem.
It is about the working directory of the program at a given moment...
I'm still working on it.
I'll post the solution as soon as I find it.
Thanks for reading,
--
Lmhelp
--
View this message in context: http://www.nabble.com/Fop-in-Java-and-Eclipse-tp23370964p23384617.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org