第三方库 (JAR) 在调试模式下不起作用 (Java)

Third party library (JAR) does not work in debug mode (Java)

在我的 java 项目中,我使用第三方库 (jar) 并在开始时调用该库的函数。

public static void main(String args[]) {
   long handle = Library.method(params);
   if (0 == handle) {
      // error
   }
}

使用eclipse进行开发。问题是,当我在 运行 模式下 运行 项目(调用 main)时,我得到了句柄。但是当我使用 DEBUG 模式调用时(没有附加任何断点),我没有得到句柄。 (run/debug设置相同,没有额外的VM或程序参数)

问题:

How can the library detect that it is called in the debug mode and prevent returning the handle?

有办法,比如:

How to find out if "debug mode" is enabled

但肯定不可能 assemble 完整的可能性列表。

How can I debug this project (I need some debug)

您要么需要找到一个可调试的版本(也许可以从库的开发者处获得额外费用?),要么克服保护。

例如,

One-guy-I-know-who-isn't-me 会首先尝试解除 assemble 库以了解它实际上是如何受到保护的。如果反汇编成功,那么甚至可以取消保护。