Robert,

Your suggestions work perfectly for me, thank you.
Step 2:
Now I'm trying to call Java from Delphi using JNI.
With the classpath set as suggested - I had to include all the .jar files in 
the .bin directory separately, since bin/* didn't work - I construct the 
desired object (Delphi 7 code, I adapted URLGrabberMainForm.pas):


Var
  Cls: JClass;
  Mid: JMethodID;
  ExampleFO2PDF: JObject;

//Construct ExampleFO2PDF object
ExampleFO2PDF := CreateJavaObject(FJNIEnv, 'embedding/ExampleFO2PDF', Cls);


This works; no error messages.
But then...


//Locate the 'convertFO2PDF' method
Mid := FJNIEnv.GetMethodID(Cls, 'convertFO2PDF', 
'(Ljava/lang/File;Ljava/lang/File;)V');

"A Java exception occurred
Java.lang.NoSuchMethodError
convertFO2PDF"

Source file ExampleFO2PDF.java contains

    public void convertFO2PDF(File fo, File pdf) throws IOException, 
FOPException

so I think I'm using GetMethodID correctly - evidently not, can someone tell me 
what I'm missing?





Regards,
Arjan Bokx

-------------------------------------------------------------------
Van: Robert Meyer [mailto:rme...@hotmail.co.uk] 
Verzonden: woensdag 2 januari 2013 10:21
Aan: fop-users@xmlgraphics.apache.org
Onderwerp: RE: FOP 1.1 embedded examples

Hi Arjan,

I did the following to get it working:

1) From the command line I went to the examples\embedding\ directory and ran 
ant to generate all the classes into a ./build/ directory.
2) I then ran the following from the same directory: 

java -cp "build/classes:../../lib/*:../../build/fop.jar" embedding.ExampleFO2PDF

It will be slightly different for you though as I am on Linux. To get it 
running on Windows you will need to change the colons for semi-colons e.g.

java -cp "build/classes;../../lib/*;../../build/fop.jar" embedding.ExampleFO2PDF

That should then generate the output successfully into the ./out/ directory.

Let me know if you are still having problems

Regards,

Robert Meyer
> From: arjan.b...@akb-ls.nl
> To: fop-users@xmlgraphics.apache.org
> Subject: FOP 1.1 embedded examples
> Date: Wed, 2 Jan 2013 07:29:14 +0000
> 
> Hello everybody,
> 
> I have a question about getting the "embedded" examples of FOP 1.1 to work.
> Is this the right place to ask?
> (If not, please redirect me and disregard the following)
> 
> My OS is Windows XP.
> I've downloaded and installed the Java SDK 1.7.0_10
> I've downloaded and installed fop 1.1
> I've downloaded and installed Ant.
> With Ant, I compiled the "embedded" examples.
> "Ant example1" correctly runs ExampleFO2PDF.
> What should I do to call ExampleFO2PDF from Java? Actually I wish to call it 
> from Delphi, using JNI, but first things first.
> "Java ExampleFO2PDF" from the command line gives:
> Exception in thread "main" java.lang.NoClassDefFoundError: ExampleFO2PDF 
> (wrong name: embedding/ExampleFO2PDF)
> 
> When I add just about every path to the classpath with the command line 
> option -cp, I get:
> Error: Could not find or load main class ExampleFO2PDF.main
> 
> Could you help me please.
> 
> 
> Regards,
> Arjan Bokx
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
> 


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

Reply via email to