question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a Java system dependency for facilitating JNI development

See original GitHub issue

I am working on Java bindings for a project. Java installations typically come with an include folder that has various headers for interacting with the JVM or the JNI. The include directory isn’t symlinked into a default header location by default, no does it typically reside in the same location across systems (Fedora, Ubuntu, Windows, Mac, etc.).

I want to propose a Java system dependency that hooks up any libraries and include directories to your project.

I am interested in creating a PR for this myself.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
dcbakercommented, Jan 20, 2021

Here’s my attempt to add some docs on writing system dependencies: https://github.com/mesonbuild/meson/pull/8228

1reaction
jpakkanecommented, Jan 20, 2021

As a dependency name jni is probably better than java. I looked into adding this ages ago but the need for it evaporated. From what I can remember it would have needed to do something like this (on Linux):

  • detect currently used JVM
  • trawl the file system for headers and libs (which are not under /usr/include but somewhere else, maybe under lib or share and, if memory serves, that path is different on Debian vs Fedora
  • build up the corresponding compile and link args

Another thing I remember pondering was that there are two different ways of doing JNI, one required compiling the source with javah or something while the newer one worked in some easier way. It would be nice to not have to support the former but I don’t know how widespread its usage is nowadays.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JNI tips | Android NDK
Keep your interface code in a low number of easily identified C++ and Java source locations to facilitate future refactors. Consider using a...
Read more >
Java Native Interface (JNI) - Java Programming Tutorial
Java supports native codes via the Java Native Interface (JNI). JNI is difficult, as it involves two languages and runtimes.
Read more >
Set up JNI development in Gradle project - IntelliJ IDEA
IntelliJ IDEA supports JNI development in Gradle projects. This tutorial uses on the Java 1.8 and Gradle 7.4 versions. The tutorial uses the...
Read more >
Java Native Interface (JNI) - IBM
Java Native Interface (JNI) is a native programming interface that is part of the Java Software Development Kit (SDK).
Read more >
Building the JDK - OpenJDK
Large portions of the JDK consists of native code, that needs to be compiled to be able to run on the target platform....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found