My project needs to use some third-party jars. I assume I drop these in the lib/ directory in my project, but where do I configure Play to add them to the classpath?
I'm developing in Eclipse, and I know I can add them to the Eclipse project's build path, but this won't necessarily make Play reference them when it runs.
To check our CLASSPATH on Windows we can open a command prompt and type echo %CLASSPATH%. To check it on a Mac you need to open a terminal and type echo $CLASSPATH.
Simply put, the classpath is just a set of paths where the java compiler and the JVM must find needed classes to compile or execute other classes.
Play automatically adds all jars in the application's lib directory to the classpath.
To quote:
A play application classpath is built as follows (in this order):
* The /conf directory for the application * The $PLAY_PATH/framework/play.jar * All jar files found in your application /lib directory * All jar files found in the $PLAY_PATH/framework/lib directory
Do not forget to do a
play ec
or
play eclipsify
when you add new jars in the lib folder. If you don't, Eclipse won't see them.
Play! runtime automatically finds third-parties jars from lib folder so don't worry for runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With