I am trying to call the Freeling (http://nlp.lsi.upc.edu/freeling/) Java API (http://devel.cpl.upc.edu/freeling/svn/trunk/APIs/java/) from ABCL (http://common-lisp.net/project/armedbear/). I followed all the procedure in the README of the Freeling Java API to, using swig, compile the API. After that, I was able to run the example code.
java -Djava.library.path=. -cp freeling.jar:. Analyzer < teste.text > teste.out
In this Analyzer.java, the relevant lines are:
...
import edu.upc.freeling.*;
...
System.loadLibrary( "freeling_javaAPI" );
...
MacoOptions op = new MacoOptions( LANG );
In ABCL I have tried:
(add-to-classpath "/Users/arademaker/Downloads/myfreeling/APIs/java/freeling.jar")
(jstatic "load" "java.lang.System" "/Users/arademaker/Downloads/myfreeling/APIs/java/libfreeling_javaAPI.so")
(jnew "edu.upc.freeling.MacoOptions" "en")
But I got the error:
Java exception 'java.lang.UnsatisfiedLinkError: edu.upc.freeling.freelingJNI.new_MacoOptions(Ljava/lang/String;)J'.
[Condition of type JAVA-EXCEPTION]
Does anyone have any idea? Any special problem of ABCL with the System.load of Java?
Following the suggestion of Alessio Stalla in http://thread.gmane.org/gmane.lisp.armedbear.devel/2923 I were able to solve my problem. The solution was to load ABCL not with the -jar parameter with:
But with the commaand line suggested:
It looks like the -jar makes java ignore the -cp parameter:
http://docs.oracle.com/javase/1.4.2/docs/tooldocs/linux/java.html
Nevertheless, it explains part of the mystery because I have also tried:
before the
So the use of "-jar" has other consequences besides ignore "-cp" parameter.