Java.lang.System.mapLibraryName() Method

Advertisements


Description

The java.lang.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

The following example shows the usage of java.lang.System.mapLibraryName() method.

package com.tutorialspoint;

import java.lang.*;

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);
   }
} 

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

Windows XP
os.name.dll



Advertisements
Advertisements