B4J Question Next Reports and Classpath

Philip Chatzigeorgiadis

Active Member
Licensed User
I am trying to build a code in B4J to export and view reports built in Next Reports.
So far, I have succeeded in exporting the text contained in the reports to RTF, PDF, HTML, EXCEL format. However, if the report contains images and the exported format is other than HTML format, no images are displayed (a "file not loaded" indication appears in the exported report file).

Here is what Next Reports documentation notes on this issue:

"The code takes care to copy those images to the folder where exported
report is generated (current directory). For HTML that is enough to view images.
For other types like PDF, RTF, DOCX, EXCEL, you will have to add the folder where you copy images to the CLASSPATH (because report images are loaded from classpath)."


So, it seems that i must add to the CLASSPATH the folder where the images are copied..
Obviously, the folder must be described in a relative way, in order to be independent of actual folder location for various machines running the program.
How can I do that in B4J?
 

Philip Chatzigeorgiadis

Active Member
Licensed User
You can set the classpath with the -cp command line argument.
java -jar <jar file> -cp folder
Erel, thank you for your quick answer.
I tried it, but the images are still not shown in the exported report files.

Please let me know if the command below is correct, assuming the images are present in the "c:\users" directory:

java -jar nxtreportsdemo.jar -cp c:\users

 
Upvote 0

Philip Chatzigeorgiadis

Active Member
Licensed User
Try:
B4X:
java -cp c:\users\* -jar <jar file>
I tried it, with no success.

However, after asking for instructions from the Next-Reports forum, i got this answer:

"When you run java with -jar option, any -classpath, or -cp options, or CLASSPATH environment variable are ignored, as JVM thinks all classes are already contained inside the jar file, or referenced via the Class-Path entry in its META-INF/MANIFEST.MF.

You should read about Manifest files and add something like this inside it:

Class-Path: ./some_directory/"


So, can you please let me know if there is a way in B4J to add directly the above entry to the META-INF/MANIFEST.MF file?
(I can do it by opening the JAR file with 7-zip and directly modifying the MANIFEST.MF with notepad++)
 
Last edited:
Upvote 0
Top