Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using external jars in Play framework

Recently, I tried to use java-image-scaling library to resize the image files. So, I set java-image-scaling jar file through Eclipse as a way that usual Eclipse project sets its external jar file. In Eclipse, there is no error (I mean, there is no red underline.) to use java-image-scaling library. However, when I try to compile it through Play! console, the compiler said it cannot find java-image-scaling jar file. It is weird because I did exactly same with Joda Time library and there was no problem.

Am I missing something to use external jar(java library) in a project of Play framework?

enter image description here

Check this screenshot that shows I already added Joda datatime library and java-image-scaling library.

like image 519
byron1st Avatar asked Jan 13 '13 08:01

byron1st


2 Answers

You have to add your dependency in the project/Build.scala file:

val appDependencies = Seq(
  "com.mortennobel" % "java-image-scaling" % "0.8.5"
)

Or you can drop your jar directly in a lib folder of your Play app.

Then, in the Play console, regenerate the Eclipse files using the command eclipsify or eclipse according to your Play version (2.1.x or 2.0.x).

For Joda time, it worked because this library is already existing in the Play dependencies.

Please refer to the Play documentation for further details.

like image 189
ndeverge Avatar answered Sep 28 '22 16:09

ndeverge


Here you find the procedure to add external jar in your project if you don't want to use dependencies: Add external Jar file to Play 2.0.4

like image 37
Marco Avatar answered Sep 28 '22 18:09

Marco