简体   繁体   中英

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

In my java project I use a third party library (jar) and call a function of that library at start.

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

Use eclipse for the development. The question is, when I run the project (call the main) in RUN mode, I get the handle. But when I call with DEBUG mode (without any breakpoints attached), I do not get the handle. (The run/debug settings are the same, no additional VM or program parameters)

Question:

  • How can the library detect that it is called in the debug mode and prevent returning the handle?
  • How can I debug this project (I need some debug)

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

There are ways, for instance:

How to find out if "debug mode" is enabled

But it is surely not possible to assemble the complete list of possibilities.

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

You'll either need to find a debuggable version (maybe available from the developer of the library for additional fees?) or overcome the protection.

One-guy-I-know-who-isn't-me would for instance first try to disassemble the library to find out how is it actually protected. If disassembly succeeds then it might be even possible to remove the protection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM