How to set classpath for libraries of Jasper Report in Java?

Hi, I was just hoping to ask if how to set the libraries (.jar files) of Jasper Reports into my Java swing app. I use the command prompt instead of an IDE so I would manually set the classpath on each enter of the java command. 

ex: java -classpath ".;mysql-connector-java-8.0.15.jar" start (this is my java file).

so how do I set the libraries for Jasper Report, I've heard there's several, that means I'll have to input it in the quotation marks and then seperate them with a semicolon? sorry I've never had to put in more than one library so I do not know. And do I also set the class path when I run the javac command for compiling also? What .jar files would I need to open a pdf file of a Jasper Report using Java swing? Thanks in advance for the help.


ml.francis's picture
Joined: Sep 2 2014 - 1:19am
Last seen: 2 years 6 months ago

1 Answer:

What about using wildcards in your cp parameter?

I would put all needed jasper and external library jars into one subfolder "lib" and just use the wildcard syntax to include them.

Which jars really needed depends on what you are doing... if you want to export to excel you would need apache-poi libs as well... if you want to export to pdf you will need itext... so it isn't really defined ... a minimal set of libs are listed here for example:

hth + regards


C-Box's picture
Joined: Jul 19 2006 - 5:58pm
Last seen: 3 months 3 days ago