2

I'm new to java i need to know where is java library path to add it in my open source i searched for is this command

which java 

gave me

/usr/bin/java
  • 3
    Possible duplicate of [Can I find out what variable java.library.path maps to on the current platform?](http://stackoverflow.com/questions/9551588/can-i-find-out-what-variable-java-library-path-maps-to-on-the-current-platform) – azurefrog Dec 22 '15 at 18:51
  • The linked question's top answer has a sample `LibPathFinder` you can use. – azurefrog Dec 22 '15 at 18:52
  • is there anyother way to know the path instead of coding ? like command in terminal ? –  Dec 22 '15 at 18:54
  • @Begnnier, Why do you need to set a native library? – Perdomoff Dec 23 '15 at 15:58
  • @Perdomoff i read that in the link you sent that i should follow steps one of them set the native libraries –  Dec 23 '15 at 16:03
  • Some Java frameworks depend on native code. Does your application depend on another language? Are you trying to add jars to your project? Help me understand what you're trying to do. – Perdomoff Dec 23 '15 at 16:10
  • i think you are right i didn't get it well , i need to know where can i find java library path i have in my pc to use it –  Dec 23 '15 at 16:13
  • Are you looking for the java home directory?" [How to find my current JAVA_HOME in ubuntu?](http://askubuntu.com/questions/459900/how-to-find-my-current-java-home-in-ubuntu) – Perdomoff Dec 23 '15 at 16:50
  • Were you able to resolve this? – Perdomoff Dec 24 '15 at 14:11
  • @Perdomoff sorry for my late reply , no i couldn't i searched manually and i got JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64 that i wrote it in bashrc but didn't help –  Dec 24 '15 at 22:23
  • Tell me what you're looking for and for what purpose? Let's fix this. – Perdomoff Dec 24 '15 at 22:30
  • 1
    @Perdomoff could that path is the java.library.path /usr/lib/jvm/java-6-openjdk-amd64/lib ? i used sudo update-alternatives --config java –  Dec 25 '15 at 17:08
  • 1
    Yes, build the application. – Perdomoff Dec 25 '15 at 17:36
  • Really Thanks @Perdomoff for your time and help –  Dec 25 '15 at 17:44

2 Answers2

8

Java:

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

console:

java -XshowSettings:properties
Perdomoff
  • 938
  • 2
  • 7
  • 26
  • 1
    is there anyother way to know the path instead of coding ? like command in terminal ? –  Dec 22 '15 at 18:54
  • i got Unrecognized option: -XshowSettings:properties Could not create the Java virtual machine. –  Dec 22 '15 at 20:09
  • @Begnnier What operating system? – Perdomoff Dec 22 '15 at 20:10
  • i checked it now again , there is no error in spaces –  Dec 22 '15 at 20:39
  • What do you get when you type in your console: echo $LD_LIBRARY_PATH – Perdomoff Dec 22 '15 at 22:45
  • @Begnnier, Read this, you may have not set it yet:[java.library.path – What is it and how to use](http://examples.javacodegeeks.com/java-basics/java-library-path-what-is-it-and-how-to-use/) – Perdomoff Dec 22 '15 at 23:24
  • i read it now and what i got that there is another way to set it by iDE and i'm using eclipse and set it already so should i set it again or not ? –  Dec 22 '15 at 23:49
  • @Begnnier, follow the link and then let's try to get that path you set. – Perdomoff Dec 22 '15 at 23:53
0

You have to follow the symbolic links.

ls -lah /usr/bin/java
/usr/bin/java -> /etc/alternatives/java

ls -lah /etc/alternatives/java
/etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Ansemo Abadía
  • 488
  • 3
  • 10
  • sorry i'm new , this lines indicates to what ? i mean this are commands or the default paths of java library ? –  Dec 22 '15 at 18:57