PDA

View Full Version : unpacking the jar files



Anonymous
06-13-2002, 04:25 PM
Help desparate!
I have been developing web interface modules in java and jsp with oracle database. I downloaded the jfreereport to add reporting capabilities to the web interface. I downloaded 0.7.4 version from the sourceforge site. I am following the instructions in the install file for 0.7.2 version. I tried to unpack the jfreereport-res-0.7.4 jar file from inside the resources directory. It came up with the message
"jar is not recognized as an internal or external command, operable program or batch file".
I am obviously clueless.
Thanks for any help installing
Sue

Anonymous
06-14-2002, 02:02 AM
Looks like jar is not within your PATH. It is part of your jdk.

Anonymous
06-14-2002, 03:02 AM
Hi,

jar-files are relabeled ZIP-files, so if you have an unzip-tool on your system, you can use this one to extract the contents.

have more fun,
said Thomas

Anonymous
06-14-2002, 11:07 AM
Hi Thomas
Thanks! winzip did it. Can you also tell me if there is an install guidelines for jfreereport-0.7.4 ? In the jfreereport site there is an install file for 0.7.2.
Sue

Anonymous
06-14-2002, 11:23 AM
Hi Thomas
I found it! By the way when unpacking, do I have to create two sub directories - lib and libs or just one subdirectory libs.
The installation instructions mention lib and libs - is it a spelling mistake? or....
I would appreciate your response.
Sue

Anonymous
06-14-2002, 01:06 PM
Hi,

the name does no longer matter. The directory name is important when setting the classpath, but most users have their own preferrences where to store needed jar files.

Using version 0.7.4 you can use a dummy-jar file to start the demonstration application. For this change into the directory where the jar files are stored, lets call this directory "libs". This directory should contain (among others) a file named "start-demo.jar". To run the demo use the command

java -jar start-demo.jar

But make sure to start this command from the libs directory, the documentation is not correct in point 4.

The demo adjusts its classpath to load the needed libraries from this directory.
When using windows and the JRE/JDK is installed correctly, you should also be able to simply double-click on the start-demo.jar file.

The documentation from version 0.7.2 is still valid in most cases, but the newer/easier way of starting the demo was not included in the older versions.

The documentation is currently being updated by David.

Have more fun,
said Thomas

P.S.:
If you have an cvs client installed, it would be best to check out the latest sources, they fix a bug in the ReportPropertyFunction.

Anonymous
06-14-2002, 02:13 PM
Hi Thomas
Double clicking startdemo.jar started the demo. Thanks. Now to use jfreereport in my application do I have to compile these java files in the source directory?
If i have to compile then should i have to add class sub directory in the main directory?
I have a web application where i retrieve a resultset from a database and I should give this resultset into the report class. I am using javaserverpages and java to develop this application. Any help is appreciated.
Sue

Anonymous
06-18-2002, 06:04 PM
Anybody? Any feedback on this please?
Sue

Anonymous
06-19-2002, 07:47 AM
Hi,

when using the binary jar file, all you have to do is to include this file (and all required files from the "libs" directory) in your applications classpath.

In case you recompile the sources, just add the sources (the contents of jfreereport-src.jar) to your IDE's sourcepath. When done, it should be compiled and used by your IDE.

When using JFreeReport in an environment where no gui is available (most unix and mainframe systems), you have to replace the default AWT with an non-native replacement which will not access the non-existent GDI resources. Have a look at http://www.eteks.com/pja/en/
for an better explaination and such a toolkit.

To create the datasource from a resultset, you can use the included ResultSetTableModelFactory which creates a tablemodel suitable to be included as datasource in JFreeReport.

The report-definition-object itself can created by using the XML-Parser:

<code>
URL in = // from where to load
ResultSet resultset = // the queryresult

TableModel datasource = ResultSetTableModelFactory.createTableModel (resultset)

ReportGenerator gen = ReportGenerator.getInstance ();
JFreeReport report1 = gen.parseReport (in, in);

report1.setData (datasource);
</code>

The report is now ready and could be printed/saved to pdf.
<code>
OutputStream out = new FileOutputStream (new File (selFileName));

PDFOutputTarget target = new PDFOutputTarget (out, pf, true);
target.open ("Title", "Author");
reportPane.getReport ().processReport (target);
target.close ();
</code>

This produces an report which is written to the given outputstream, in this case a file-stream. If your reports should use embedded true-type fonts, you have to register the used fonts by using
PDFOutputTarget.getFontFactory().registerFontFile (String pathToTTFFile);
or
PDFOutputTarget.getFontFactory().registerFontPath (String pathToTTFDirectory);


Have more fun,
said Thomas