I have a third party java application called MITIE that I am currently testing to potentially integrate it into a java project. I have compiled the code and can run it using the following script (run.sh):
我有一个名为MITIE的第三方Java应用程序,我目前正在测试它可能将它集成到一个java项目中。我编译了代码,可以使用以下脚本运行它(run.sh):
export LD_LIBRARY_PATH=/opt/MITIE/mitielib
export CLASSPATH=/opt/MITIE/mitielib/javamitie.jar:.
javac NerExample.java
java NerExample
Everything runs fine. What I want to do is be able put the export commands in my ~/.bashrc so I can run this library within a java project or just type java NerExample on the command line and not have to worry about setting the LD_LIBRARY_PATH or CLASSPATH.
一切都运行良好。我想要做的是能够将导出命令放在我的〜/ .bashrc中,这样我就可以在java项目中运行这个库,或者只需在命令行输入java NerExample,而不必担心设置LD_LIBRARY_PATH或CLASSPATH。
I added the two export statements to my ~/.bashrc profile and then removed them from the script and I get the error:
我将两个导出语句添加到我的〜/ .bashrc配置文件中,然后从脚本中删除它们,我得到错误:
Native code library failed to load.
java.lang.UnsatisfiedLinkError: no javamitie in java.library.path
If I put the export statements back into the script it works. My question is, is it possible to set these globally on my system?
如果我将导出语句放回脚本中就可以了。我的问题是,是否可以在我的系统上全局设置这些?
1 个解决方案
#1
0
Your classpath can be extended in /etc/profile export classpath=$CLASSPATH:/add/to/classpath. Sorry I am typing on my phone so you need to correct that. aps.
您的类路径可以在/ etc / profile export classpath = $ CLASSPATH:/ add / to / classpath中扩展。对不起,我在手机上打字,所以你需要纠正。 APS。
Your LD_LIBRARY_PATH is not necessary if you add a line to /etc/ld.so.conf then sudo ldconfig.
如果在/etc/ld.so.conf中添加一行,则不需要LD_LIBRARY_PATH,然后再添加sudo ldconfig。
#1
0
Your classpath can be extended in /etc/profile export classpath=$CLASSPATH:/add/to/classpath. Sorry I am typing on my phone so you need to correct that. aps.
您的类路径可以在/ etc / profile export classpath = $ CLASSPATH:/ add / to / classpath中扩展。对不起,我在手机上打字,所以你需要纠正。 APS。
Your LD_LIBRARY_PATH is not necessary if you add a line to /etc/ld.so.conf then sudo ldconfig.
如果在/etc/ld.so.conf中添加一行,则不需要LD_LIBRARY_PATH,然后再添加sudo ldconfig。