java.lang.UnsatisfiedLinkError: Can't load library: ...libmawt.so[1]
In this article, we will look at setting environment variables to revolve this kind of errors assuming missing libraries are installed correctly and have appropriate permissions and ownership.
Tell Whom Where to Find What
Different environment variables differ in the following aspects:
- Tell whom where to find what
Environment Variable | Whom | What | Description |
PATH | Windows | /bin | When a command is entered in a command shell or a system call is made by a program to execute a program, the system first searches the current working directory and then searches the path, examining each directory from left to right, looking for an executable filename (EXE, COM, BAT, or CMD) that matches the command name given. |
/lib | Set the shared library path environment variable. | ||
PATH | Linux | /bin | Tells the shell which directories to search for executable files in response to commands issued by a user.[2] |
LIBPATH | AIX | /lib | Set the shared library path environment variable.[16] |
LD_LIBRARY_PATH | Linux Unix Solaris | /lib |
|
JAVA_HOME | WebLogic,[9] IDEs,[8] Other Programs | JRE (Java runtime environment) |
|
classpath or CLASSPATH | Java Launcher or Java Compiler | User-defined classes and packages[10] |
|
Here are the summarized system properties used during class loading based on the above criteria:
System Property | Whom | What | Description |
java.library.path | JVM | native libraries | The Java Virtual Machine (JVM) uses the java.library.path property in order to locate native libraries. This property is part of the system environment used by Java, in order to locate and load native libraries used by an application. Note that java.library.path is linked to LIBPATH or PATH or LD_LIBRARY_PATH, depending on the OS. |
sun.boot.library.path | JVM | native libraries | The Java Virtual Machine (JVM) uses the sun.boot.library.path property in order to locate native libraries. This property is part of the system environment used by Java, in order to locate and load native libraries used by an application. Note that sun.boot.library.path is searched before java.library.path. |
Conclusions
If you have set your shared-library-path environment variable[3,4,5] and system properties[15] correctly, you should be able to resolve this error. Read [1,15] for more information.
java.lang.UnsatisfiedLinkError: Can't load library: ...libmawt.so[1]
When you set environment variables, you want to consider which user(s) you want to set them for. For example, you can set environment variables for either your user only, or for all users (System variables). If you run Java applications in a WebLogic server, oftentimes you set environment variables such as LD_LIBRARY_PATH, etc. in the setDomainEnv.cmd/sh script (see also setWLSEnv.cmd/sh script) of a WebLogic domain.[6] In this way, you can avoid setting environment variables in the global scope, which may affect other applications.
As you may have noticed, there are idiosyncrasies of environment variables among platforms. For example, to set the shared-library-path environment variable, you do this differently on different platforms:
Operation System |
Environment Variable |
Windows |
PATH |
AIX |
LIBPATH |
Solaris and Linux |
LD_LIBRARY_PATH |
HP-UX |
SHLIB_PATH |
References
- Can't load library libmawt.so
- PATH Definition
- Purpose of JAVA_HOME and PATH environment variables ?
- Why do you need JAVA_HOME environment variable?
- To ensure that your Java programs pick the right Java.exe
- To specify which installed versions of Java as default
- To use tools/libraries only available in JDK
- Shared Libraries
- weblogic.Server Command-Line Reference
- classpath (Java)
- Configuring JDeveloper with a Different JDK (Xml and More)
- Configuring WebLogic Server with a Different JVM (Xml and More)
- Java Throwable: ClassNotFoundException vs. NoClassDefFoundError (Xml and More)
- WebLogic's Classloading Framework (Xml and More)
- Using the Classloader Analysis Tool (CAT)
- WebLogic Server (WLS) Support Pattern: Investigating Different Classloading Issues (Doc ID 1572862.1)
- Installing the JDK Software and Setting JAVA_HOME
- java.library.path – What is it and how to use
- LIBPATH: Setting library search paths
- Setting up the ODWEK application development environment
- java classpath separator
- In Unix/Linux/Solaris
- CLASSPATH are separated by colons(:)
- In Windows
- CLASSPATH are separated by semicolons(;)
- If the message says "java.lang.UnsatisfiedLinkError: no lwjgl in java.library.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
- Error: Could not find or load main class weblogic.Server
- Check your classpath or CLASSPATH
- Java Evolution: JDK and JRE File Structure (Xml and More)
No comments:
Post a Comment