Part of my tries to understand why my code is hanging when running in different OS, I had to debug different eclipse plugins. I saw the following code in some Java file:
Library.loadLibrary("swt")
Based on What are native methods in Java and where should they be used?, I understand that native methods are used to execute functions written in different programming languages. But I have two question regarding it:
- When
loadLibrary
is called with the input"swt"
, what actually happens? WhereloadLibrary
looks for SWT library and how can I change it? What is the equivalent command in Linux to get the library (I guess it's some shared library)? - Consider the following code:
public static final native void _gtk_widget_destroy(long /*int*/ widget);
public static final void gtk_widget_destroy(long /*int*/ widget) {
lock.lock();
try {
_gtk_widget_destroy(widget);
} finally {
lock.unlock();
}
}
The _gtk_widget_destroy
method is native. Does it mean that there is a method in another language (probably C) that is called _gtk_widget_destroy
? How do I know from which library this method is coming from (maybe SWT)?