1

I am working with Ubuntu 16.04 and there I have a project where I need to add the path "usr/local/MATLAB/R2017a/bin/glnxa64" as VM argument or Native Library Location, but I would like to avoid doing it, so I have read that I could do this by adding this line on .bashrc file

export LD_LIBRARY_PATH=/usr/local/MATLAB/R2017a/bin/glnxa64:/usr/local/MATLAB/R2017a/sys/os/glnxa64

Apparently it is working because when I wrote the command "java -XshowSettings:properties" on the terminal I got this output:

java.library.path = /usr/local/MATLAB/R2017a/bin/glnxa64
        /usr/local/MATLAB/R2017a/sys/os/glnxa64
        /usr/java/packages/lib/amd64
        /usr/lib64
        /lib64
        /lib
        /usr/lib

As you can notice the two firts paths are the ones that I set on the bashrc file.

But WHY when I run this lines on Java:

String path = System.getProperty("java.library.path");
        System.out.println(path);

I got this output:

/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

Why are the firts two paths missing ? how can I Do this?

Andy Thomas
  • 84,978
  • 11
  • 107
  • 151
  • Eclipse is not running java from a shell. – pvg Jun 27 '17 at 18:56
  • In the Eclipse run configurations, there is a tab where you can specify environment variables to be used when launching an application. Or you could set `java.library.path` on the Arguments tab. – Andy Thomas Jun 27 '17 at 18:58
  • @AndyThomas it is the same as VM arguments? – Manuel Sebastian Rios Jun 27 '17 at 19:17
  • @pvg How can I make it run from a shell ? Its my firts time working java – Manuel Sebastian Rios Jun 27 '17 at 19:17
  • Right, you can define `java.library.path` in the "VM arguments" section of the Arguments tab. – Andy Thomas Jun 27 '17 at 19:20
  • @ManuelSebastianRios you want to set up Eclipse to give the VM the right parameters, like the other commenter is telling you. I only bring up the shell so you know that things you configure there are not necessarily going to be picked up by an IDE like Eclipse. – pvg Jun 27 '17 at 19:22
  • The reason I am asking this is because I am getting a No classFound Error when I am running the code from terminal. and Also when I am trying to deploy this as a Tomcat web service and I already set Catalina_Opts in setenv.sh I have no more Ideas of how to make this work – Manuel Sebastian Rios Jun 27 '17 at 19:30

0 Answers0