Comments (7)
I might have made an embarrassing mistake since the test file is not under the example directory.
from crfpp.
Hi eduOS,
libCRFPP.so is created when you run make
in the java/ directory, and you need to add the directory containing it to your java.library.path
Java variable. However, it also tries to load libCRFPP.lib (or .dll on Windows) created with make
in the project root directory. So you need to make both of those available.
You can look at my fork if you are having trouble compiling on Windows (although there is no installation and you have to configure paths manually).
On Linux I installed it like this:
cd crfpp
chmod +x configure
./configure
make
make install
cd java
make
cp CRFPP.jar /usr/local/lib/CRFPP.jar
cp libCRFPP.so /usr/local/lib/libCRFPP.so
echo "/usr/local/lib" >> /etc/ld.so.conf.d/lib.conf
ldconfig
Then I add /usr/local/lib
to my java.library.path
and it finds everything.
from crfpp.
Thanks so much for your help. I run into one more error now while make in the java directory:
c++ -O3 -c -fpic CRFPP_wrap.cxx -I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux
CRFPP_wrap.cxx:159:17: fatal error: jni.h: No such file or directory
#include <jni.h>
^
compilation terminated.
make: *** [all] Error 1
It seems that jni.h file is lost.
My OS is Ubuntu 14.04 and the version of my Java is 1.8.x. Should I change Java 8 to Java 1.7.x?
from crfpp.
Yeah, the make files for Linux have hardcoded paths to the Java include files. /usr/lib/jvm/java-7-openjdk-amd64/ probably does not exist. You need to edit the makefile to match your Java installation, probably java-8-... if you installed the latest version.
from crfpp.
You're right. I have edited the Makefile replacing the java-7 to the path of java-8 directory containing jni.h. But I met this:
c++ -O3 -c -fpic CRFPP_wrap.cxx -I/home/leo/lerner/Java/jdk1.8.0_71/include -I/home/leo/lerner/Java/jdk1.8.0_71/include/linux
c++ -shared CRFPP_wrap.o -o libCRFPP.so -lcrfpp -lpthread
javac org/chasen/crfpp/*.java
javac test.java
jar cfv CRFPP.jar org/chasen/crfpp/*.class
/bin/sh: 1: jar: not found
make: *** [all] Error 127
Should I also tell it where to find the jar?
I found that no jar file exists under the java directory.
I have set the path and I can run jar in my zsh terminal but the error appears all the same.
from crfpp.
I thought the CRFPP.jar cannot be created. Everything about java path is properly set in /etc/profile.
Ironically I can manually create the jar file by:
`jar cfv CRFPP.jar org/chasen/crfpp/*.class``
The question is why cannot the script? Is it that the script uses bash and cannot find the jar command while I, using the zsh, can?
I add the java.library.path by:
Select your project in the Package Explorer area and press a right click on it.
Select Build Path → Configure Build Path... option.
In the appearing window, select the Libraries tab.
Then, expand the JRE System library option and select the Native library location.
Click on the Edit... button at the right panel.
Locate the required library and then click OK.
Close the window.
or for the terminal:
java -Djava.library.path=/usr/local/lib test
But the fourth error occurred:
Exception in thread "main" java.lang.RuntimeException: feature_index.cpp(193) [mmap_.open(model_filename)] mmap.h(153) [(fd = ::open(filename, flag | O_BINARY)) >= 0] open failed: ../model
at org.chasen.crfpp.CRFPPJNI.new_Tagger(Native Method)
at org.chasen.crfpp.Tagger.<init>(Tagger.java:183)
at test.main(test.java:6)
Normally a model is produced after the training, @garfieldnate I reach the place where you are now. Haha.
from crfpp.
This issue becomes the same as #26 .
from crfpp.
Related Issues (20)
- crf_learn crashes if model file is not writable HOT 1
- A Question on forward-backward algorithm in CRF++ HOT 10
- run make command on centos 7 system, but hint winmain.h not found. HOT 2
- build with python error HOT 3
- install crf++ failed HOT 2
- why crf_test took long time HOT 2
- Any python api for predict using the model we have trained before? HOT 1
- USAGE - adding category of sentence as a feature
- where is the readme file ?
- template : %x[-1,0]/%x[0,0] bigram or unigram? how many features it will generate?
- what's the meaning of this export? HOT 2
- doubt of condition judgement in "param.cpp"
- error in crf++, while running crf_learn HOT 5
- how to change the window size ?
- how to debug
- Build fails on Mac OS X 10.14.4 HOT 1
- crf_learn interrupts after first iteration
- Learned model via version 0.59, and then test via version 0.58, error happens while loading model
- Make error for CRF++-0.51
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crfpp.