A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/java/lang/system_maplibraryname.htm below:

Java System mapLibraryName() Method

Java System mapLibraryName() Method Description

The Java System mapLibraryName() method maps a library name into a platform-specific string representing a native library.

Declaration

Following is the declaration for java.lang.System.mapLibraryName() method

public static String mapLibraryName(String libname)
Parameters

libname − This is the name of the library.

Return Value

This method returns a platform-dependent native library name.

Exception

NullPointerException − if libname is null

Example: Mapping a Library name for Operating System Name

The following example shows the usage of Java System mapLibraryName() method. In this program, we've retrieved Operating System name using "os.name" key and then using mapLibraryName(), corresponding mapped library is printed.

package com.tutorialspoint;

public class SystemDemo {

   public static void main(String[] args) {

      // prints the name of the Operating System
      System.out.println(System.getProperty("os.name"));

      /* maps a library name into a platform-specific string representing
         a native library */
      String str = System.mapLibraryName("os.name");   
      System.out.println(str);
   }
} 
Output

Let us compile and run the above program, this will produce the following result −

Windows 11
os.name.dll
Example: Mapping a Library name for User Directory

The following example shows the usage of Java System mapLibraryName() method. In this program, we've retrieved user directory name using "user.dir" key and then using mapLibraryName(), corresponding mapped library is printed.

package com.tutorialspoint;

public class SystemDemo {

   public static void main(String[] args) {

      // prints the name of the User Directory
      System.out.println(System.getProperty("user.dir"));

      /* maps a library name into a platform-specific string representing
         a native library */
      String str = System.mapLibraryName("user.dir");   
      System.out.println(str);
   }
} 
Output

Let us compile and run the above program, this will produce the following result −

C:\Users\Tutorialspoint\eclipse-workspace\Tutorialspoint
user.dir.dll
Example: Mapping a Library name for Java Version

The following example shows the usage of Java System mapLibraryName() method. In this program, we've retrieved user directory name using "java.runtime.version" key and then using mapLibraryName(), corresponding mapped library is printed.

package com.tutorialspoint;

public class SystemDemo {

   public static void main(String[] args) {

      // prints the name of the User Directory
      System.out.println(System.getProperty("java.runtime.version"));

      /* maps a library name into a platform-specific string representing
         a native library */
      String str = System.mapLibraryName("java.runtime.version");   
      System.out.println(str);
   }
} 
Output

Let us compile and run the above program, this will produce the following result −

21.0.2+13-LTS-58
java.runtime.version.dll

java_lang_system.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4