Compile:
g++ hello_world.cpp -I${HADOOP_HOME}/include -L${HADOOP_HOME}/lib/native -lhdfs -L${JAVA_HOME}/lib/server -ljvm
The final run Java programs, so not only hdfs dynamic library, the library also need jvm
I installed the version of openjdk11,11 canceled after jre directory, the directory structure of the rectification again
Run error can not mount a dynamic library
- error while loading shared libraries: libjvm.so: cannot open shared object file: No such file or directory
- error while loading shared libraries: libhdfs.so.0.0.0: cannot open shared object file: No such file or directory
Solution :
- Add dynamic link library to
/etc/ld.so.conf.f
the
vim /etc/ld.so.conf.d/hdfs.conf
java的动态链接库路径$JAVA_HOME/lib/server
libhdfs的动态链接库路径$HADOOP_HOME/lib/native
(改成自己的目录就是了)
- Excuting an order:
ldconfig -v