How do I get a list of JNI libraries which are loaded?

前端 未结 7 1984
半阙折子戏
半阙折子戏 2020-11-28 07:54

Just what the subject says, is there a way in Java to get a list of all the JNI native libraries which have been loaded at any given time?

7条回答
  •  时光说笑
    2020-11-28 08:15

    Since Nicolas mentioned Scala, here is one way to do jitter's solution via JRuby (tested in 1.6 and 1.7):

    require 'java'
    import 'java.lang.ClassLoader'
    f = ClassLoader.java_class.declared_field('loadedLibraryNames')
    f.accessible = true
    f.value(ClassLoader.system_class_loader).to_array.to_a
    

提交回复
热议问题