I am not usually a Java programmer, but I need to locate for example, which native functions (or APIs) are used in something like java.io.File.createNewFile() on Linux?

Initially, I am thinking of 2 methods:

  1. Locate the source code for the JRE implementation and try to find OS-specific code path of how this is handled starting at File.createNewFile() and working my way down.

  2. (Probably more of a hassle) Write a small program and try to attach a debugger to the JRE, breaking on various file-related calls or memory accesses.

  3. Do #2 except just use strace on Linux. I feel like this may be loud and difficult to hunt down, but possible.

I have not yet had success with #1 as the Java code seems to have a lot of wrappers and it's not clear how the managed code maps to the native code, especially between platforms.

Do you have any suggestions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.