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

0

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: 4 weeks 1 day ago

1 Answer:

0

What about using wildcards in your cp parameter?

https://stackoverflow.com/questions/219585/including-all-the-jars-in-a-directory-within-the-java-classpath

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: https://stackoverflow.com/questions/25069522/jars-needed-for-jasperreports

hth + regards

C-Box

C-Box's picture
2373
Joined: Jul 19 2006 - 5:58pm
Last seen: 1 month 1 day ago
Feedback
randomness