• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is java.library.path?

 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wonder what is java.library.path? where should i set this and how?

please guide.

 
Alex Aver
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Vanchi,

Your application tries to load a native library called liblwjgl.so (Linux) or lwjgl.dll (Windows).
Check to see if this file exists and what it's file permissions are.
This problem most often shows up because the file does not exist, has incorrect file permissions, or can not be located by the JVM.

Under Linux set LD_LIBRARY_PATH.
Under Windows set PATH.
 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex,

Thanks, I found the lwjgl.dll files, there are about 4 dll files. Where should i put them?

How to find out that JVM is looking for a '.dll' or '.so' module from the exception thrown?

regards,

 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The message says "java.lang.UnsatisfiedLinkError: no lwjgl in java.libr
ary.path". The "lwjgl" is interpreted in a platform-dependent way. On Windows, it means LWJGL.DLL . On Linux and many other UNIX variants, it means "liblwjgl.so". On other platforms, it may mean something else. You're just supposed to know what it means on your platform.

Since you're on windows, just make sure the file(s) are in a directory named on your PATH environment variable; you could add an entry if need be.
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From memory JNI is a bit of a pain (on Windows any way) in that it can also say it can't find things when it means it can't load things so if your DLL needs another DLL you can sometimes get this error.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.library.path is the path that Java uses to find native libraries (such as lwjgl.dll). You should set it to the directory that contains the DLL files. You specify this with the -D switch on the command line, for example:

java -Djava.library.path=C:\Java\ljwgl\libs org.mypackage.MyProgram

*edit* Oh, this is an old topic from 2005. (Chris, the original poster is most likely not still waiting for an answer...).
 
Nitin Harane
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.library.path is the path that Java uses to find native libraries (such as lwjgl.dll).
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin Harane welcome to the Ranch
 
Jitendra Kumar Jain
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it override all the set path via -Djava.library.path?
 
nitss bhavsar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.UnsatisfiedLinkError: no CommonControl in java.library.path?
Here Common control means ?Exactly what i have to include in path?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"CommonControl" is the name of the native library that Java is looking for. If this is on Windows, it's looking for a file named "CommonControl.dll".

You'll have to include the name of the directory that contains CommonControl.dll in the java.library.path.
 
sankar.lp gym
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vanchin

From your question, i assumed that, you are trying load a native library

There are two ways you can load the native library

1. System.loadLibrary(String)
2. System.load(String)

System.loadLibrary(String) uses the default path.
System.load(String) uses the absolute path

Assume, you are working on the windows environment

The JVM will search for your dll file in java.library.path system property

If your dll directory is not specified in the java.library.path system property, you get this error.

Sankar.lp.gym
 
Rudra Nath
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've set java.library.path like this:
JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=512m -Djava.library.path=C:/apache-tomcat-6.0.36/lib/ocijdbc11.dll"
but I' m getting attached error.
err2.jpg
[Thumbnail for err2.jpg]
err1.jpg
[Thumbnail for err1.jpg]
 
Rudra Nath
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added kernel32.dll,msvcr80 and ocijdbc11.dll in tomcat/bin folder; still I'm facing error: UnsatisfiedLinkError:
error.jpg
[Thumbnail for error.jpg]
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't let java.library.path point to the DLL itself, but to the directory that contains the DLL:

-Djava.library.path=C:/apache-tomcat-6.0.36/lib

NOT: -Djava.library.path=C:/apache-tomcat-6.0.36/lib/ocijdbc11.dll
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic