Home » Java programming language

Java System class mapLibraryName() method with example

System class mapLibraryName() method: Here, we are going to learn about the mapLibraryName() method of System class with its syntax and example.
Submitted by Preeti Jain, on September 15, 2019

System class mapLibraryName() method

  • mapLibraryName() method is available in java.lang package.
  • mapLibraryName() method is used to map a given library name into a platform-dependent native library name. This is a universal method for mapping a library name into the platform-specific name.
  • mapLibraryName() method is static a method, it is accessible with the class name too.
  • mapLibraryName() method may throw an exception at the time of library name mapping: NullPointerException: In this exception if the mapped library name is null.


    public static String mapLibraryName(String library_name);


  • String library_name – represents the name of the library.

Return value:

The return type of this method is String, it returns the mapped the given the library name.


// Java program to demonstrate the example of 
// mapLibraryName() method of System Class

public class MapLibraryNameMethod {
    public static void main(String[] args) {
        // Display the version of operating system

        // Here, we are calling the  mapLibraryName() method
        // that will be used to map a library name (os.version) 
        // into a platform-specific string representing a native library
        String s = System.mapLibraryName("os.version");


E:\Programs>javac MapLibraryNameMethod.java
E:\Programs>java MapLibraryNameMethod

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.