Solved

FOP with NetBeans

Posted on 2007-04-04
11
2,310 Views
Last Modified: 2008-02-26
Righty ho, let me make it clear first. Im a newbie in Java. Ive crosstraining from C++, so you gotta bear with me if u go into pure java and I aint got a clue what you talking about :)

Im using NetBeans v5.5 and Ive downloaded FOP 0.9.3

I am trying to create a simple example of creating a pdf

Within NetBeans project, I added all the JARs in the lib folder of FOP

Here is a snippet of my code


//Java
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

//SAX
import org.xml.sax.InputSource;

//Avalon
import org.apache.avalon.framework.ExceptionUtil;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.ConsoleLogger;

//FOP
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.FOPException;
import org.apache.fop.messaging.MessageHandler;



avalon framework came with the distribution of FOP, so thats fine, compiler is not complaining about that. What is dont like is org.apache.fop

ExampleFO2PDF.java:27: package org.apache.fop.apps does not exist
import org.apache.fop.apps.Driver;

ExampleFO2PDF.java:28: package org.apache.fop.apps does not exist
import org.apache.fop.apps.FOPException;

ExampleFO2PDF.java:29: package org.apache.fop.messaging does not exist
import org.apache.fop.messaging.MessageHandler;



Because of this, the rest of the code is failing unknown symbols



This is all part of the velocity templating exercise Im doing. I have already got velocity templating to work, I just want to use FOP now.
0
Comment
Question by:rockiroads
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 18851910
>>Within NetBeans project, I added all the JARs in the lib folder of FOP

Make sure you *really* have
0
 
LVL 65

Author Comment

by:rockiroads
ID: 18851995
Yes I have
Im wondering now as the sample code I have is based on the older version of FOP and I am using the new version

So Im just double checking everything. I think this might be the issue
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18852042
Please print output of

System.out.println(System.getProperty("java.class.path"));
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 65

Author Comment

by:rockiroads
ID: 18852968
Right back to tacking this

thanks for your response CEHJ, this is the output

C:\Java\fop-0.93\lib\avalon-framework-4.2.0.jar;C:\Java\fop-0.93\lib\batik-all-1.6.jar;C:\Java\fop-0.93\lib\commons-io-1.1.jar;C:\Java\fop-0.93\lib\commons-logging-1.0.4.jar;C:\Java\fop-0.93\lib\serializer-2.7.0.jar;C:\Java\fop-0.93\lib\xalan-2.7.0.jar;C:\Java\fop-0.93\lib\xercesImpl-2.7.1.jar;C:\Java\fop-0.93\lib\xml-apis-1.3.02.jar;C:\Java\fop-0.93\lib\xmlgraphics-commons-1.1.jar;C:\Java\FOP\fop-0.93\lib\Jimi\examples\AppletDemo\JimiProClasses.jar;C:\Dipak\Java\Code Examples\FOPit1\build\classes



I have installed FOP under c:\java as u can see
FOPit1 is the name of my project
I cannot find any libs for that missing package in this fop 0.9.3 distribution
0
 
LVL 65

Author Comment

by:rockiroads
ID: 18853010
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18853018
Which of the below jars contains the FOP classes?

C:\Java\fop-0.93\lib\avalon-framework-4.2.0.jar
C:\Java\fop-0.93\lib\batik-all-1.6.jar
C:\Java\fop-0.93\lib\commons-io-1.1.jar
C:\Java\fop-0.93\lib\commons-logging-1.0.4.jar
C:\Java\fop-0.93\lib\serializer-2.7.0.jar
C:\Java\fop-0.93\lib\xalan-2.7.0.jar
C:\Java\fop-0.93\lib\xercesImpl-2.7.1.jar
C:\Java\fop-0.93\lib\xml-apis-1.3.02.jar
C:\Java\fop-0.93\lib\xmlgraphics-commons-1.1.jar
C:\Java\FOP\fop-0.93\lib\Jimi\examples\AppletDemo\JimiProClasses.jar
C:\Dipak\Java\Code Examples\FOPit1\build\classes
0
 
LVL 65

Author Comment

by:rockiroads
ID: 18853193
Thats what Im trying to find out. This is what I think is missing. I dont know where it can be found. I took the binary and source download of FOP but it doesnt seem like its there
Im going thru other sample code, see if its a package in terms of source and not a library and I would then need to add that to my project

As Im new to FOP (and Java!), Im hoping some EE expert would be able to know what's missing
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 18853411
You need the jar fop.jar from the binary distro which is here

http://archive.apache.org/dist/xmlgraphics/fop/binaries/fop-0.93-bin-jdk1.4.zip
0
 
LVL 65

Author Comment

by:rockiroads
ID: 18853759
Ive already downloaded that but I missed fop.jar. Must of been a long day as I did do a search for fop, perhaps I should of searched for *.jar instead, doh!

anyways, the two examples I have, one is now compiling (one listed above), the other does not, that is using fop.apps.Driver
It could be that it is no longer available.
Either way, problem is solved

Thank you very much for that. Sometimes it needs a 2nd pair of eyes to see something that is right in front of you
0
 
LVL 65

Author Comment

by:rockiroads
ID: 18853801
Ive yet to write my first simple java program.
My first java program was to create a servlet using velocity templating, talk about going straight into the deep end! Next step is formatted objects
oh well

thanks for all your help, you have saved me a lot of hassle and frustration
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18854022
No problem - glad to help

:-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question