I downloaded all the JaCoP available files recently (that is, JaCoP 3.1.1). I tested on Java and the examples are working fine.
I then tried to compile the Scala version but I didn't manage to get it work yet. The following command line:
<scala-2.9.1_dir>/bin/scalac -classpath scalaJaCoP/JaCoP-3.1.1.jar scalaJaCoP/*.scala
gives me the following error:
error: error while loading GCC, Missing dependency 'class java.util.ArrayDeque', required by scalaJaCoP/JaCoP-3.1.1.jar(JaCoP/constraints/GCC.class)
scalaJaCoP/globals.scala:63: error: JaCoP.constraints.GCC does not have a constructor
val c = new GCC( x.asInstanceOf[Array[JaCoP.core.IntVar]], y.asInstanceOf[Array[JaCoP.core.IntVar]] )
It seems like an error with the JVM version. Is it working this way because the JaCoP jar file was compiled using Java 1.5? Or did I do something wrong?
I then tried to compile the JaCoP source files myself, but it didn't work either because of library dependencies. Do you have any Makefile to help me in this task?
I am working on Linux (Ubuntu) 64 bits, Java 1.6 and using Scala 2.9.1.
java.util.ArrayDeque has been introduced in Java since version 1.6. Are you sure you use Java 1.6?
The other problem might be a path to JaCoP-3.1.1.jar. Do you have it in directory scalaJaCoP?
Are you sure that your Scala compiler is using Java 1.5? It looks like it is using an Java 1.5 thus the problem with ArrayDeque class. You can write a small test program in Scala that uses ArrayDeque and see if it compiles.
The source code for JaCoP is also available so you can always work with source code. We use Java 1.6 and we do not use any fancy switches when generating the library, so I think the problem lies with your Scala compiler.
Thanks for your help, I did it after hours of struggle!
It was a conflict caused by the JVMs that are installed on my machine. The scalac command needed a classpath pointer to Java 1.6 (then it compiled), but for some reason, at runtime the scala command was using my Java 1.5 (even after setting the update-alternative, the JAVA_HOME, etc.). I only forced scala to use Java 1.6 by executing the following command:
env JAVACMD=<path_to_java1.6> scala [...]
and finally it worked.
Good! Please, feel free to ask question regarding scala wrapper. BTW, you can find examples at http://hakank.org/jacop/jacop_scala.html
Thank you very much. I am discovering both JaCoP and scala, and it is a very good challenge for me to work with both at the same time! I already found the example link you mentionned and for sure they will be of great help for me. Just for confirmation, there isn't any documentation for this scala wrapper, is there?
Should I run into more troubles, I will ask for help in this forum.
Sorry, but there is no documentation yet. It is still experimental implementation. Of course, please ask question and I will try to answer and help.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.