在Ubuntu上设置Java环境路径的麻烦(libjvm.so:无法打开共享对象文件:没有这样的文件或目录) [英] Trouble in Setting Java Environment Path on Ubuntu (libjvm.so: cannot open shared object file: No such file or directory)

查看:434
本文介绍了在Ubuntu上设置Java环境路径的麻烦(libjvm.so:无法打开共享对象文件:没有这样的文件或目录)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

找到解决方案!

Ubuntu默认情况下忽略命令RD_LIBRARY_PATH,因此我需要将这些代码添加到.bashrc而不是/ etc / environment 或.profile。

Ubuntu by default ignore the command "RD_LIBRARY_PATH" therefore I need to add those codes in ".bashrc" instead of "/etc/environment" or .profile.

现在工作完全正常!

我正在尝试运行一个从C / C ++代码读取Java方法的程序。 (我在Windows上成功了,现在我正在使用Linux)

I am trying to run a program that reads Java method from C/C++ code. (I made it on Windows successfully, now, I am working on Linux)

我使它成功编译并在Ubuntu上运行,但问题是..
每当我尝试运行程序,我必须在终端上键入以下命令。

I made it successfully compiled and run on Ubuntu, however, the problem is.. Whenever I try to run the program, I have to type following commands on terminal..

source /etc/environment
./invoke #program name is invoke

如果我不输入source / etc /环境每次启动我的电脑,我得到的错误信息是...

If I do not type "source /etc/environment" every time I boot my PC, the error message I get is...

error while loading shared libraries: libjvm.so: cannot open shared object file: No such file or directory

好的。这是我在/ etc / environment中添加的内容

Ok. Here is what I added in /etc/environment

export PATH="$PATH:/usr/lib/jvm/jdk1.7.0_25_x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_25_x64
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server

我想要的是,正如你所知,我想运行程序而不输入source / etc / environment。
我也尝试在/ etc / profile上键入这些路径,但是结果是一样的...我应该在每次重新启动PC时输入source / etc / profile。

What I want is that, as you know, I want to run the program without typing "source /etc/environment". I also tried typing those PATHs on /etc/profile, but result was same... I should type "source /etc/profile" every time I reboot my PC..

如果您每次启动时,如何将其永久应用于系统的整个系统,而无需键入source / etc / environment内容?

How to make it permanently applied to whole range of System without typing "source /etc/environment" stuffs everytime I boot?

如果您需要请参阅程序的源代码,这里是可下载的地址:
http://cfile237.uf .daum.net / attach / 247819495212DF1C07B9EB

if you need to see source code of the program, here is downloadable address: http://cfile237.uf.daum.net/attach/247819495212DF1C07B9EB

推荐答案

找到解决方案!

Ubuntu默认情况下忽略命令RD_LIBRARY_PATH,因此我需要在.bashrc中添加这些代码,而不是/ etc / environment或.profile。

Ubuntu by default ignore the command "RD_LIBRARY_PATH" therefore I need to add those codes in ".bashrc" instead of "/etc/environment" or .profile.

现在工作完全正常!

这篇关于在Ubuntu上设置Java环境路径的麻烦(libjvm.so:无法打开共享对象文件:没有这样的文件或目录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆