Skip to content

Casterlabs/jni-headers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jni-headers

Pre-extracted JNI header files from Eclipse Adoptium builds, ready to use in your C/C++ projects without needing a full JDK installed. Since all platform-specific headers are included, this is especially useful for cross-compilation builds where the target JDK may not be available on the host machine.

Available Versions

  • Java 8
  • Java 11
  • Java 17
  • Java 21
  • Java 25

Each version includes the platform-independent headers (jni.h, jvmti.h, etc.) along with platform-specific subdirectories (linux/, win32/, darwin/).

Usage

Clone this repo (or add it as a submodule) into your project's include directory:

git clone --depth=1 https://github.com/Casterlabs/jni-headers.git include/jni

Or as a Git submodule:

git submodule add https://github.com/Casterlabs/jni-headers.git include/jni

Compiling on Linux

gcc -I include/jni/versions/17/include \
    -I include/jni/versions/17/include/linux \
    -shared -o libmyjni.so myjni.c

Compiling on macOS

gcc -I include/jni/versions/17/include \
    -I include/jni/versions/17/include/darwin \
    -shared -o libmyjni.dylib myjni.c

Compiling on Windows (MSVC)

cl /I include\jni\versions\17\include ^
   /I include\jni\versions\17\include\win32 ^
   /LD myjni.c /Fe:myjni.dll

Regenerating

To regenerate the headers from the latest Adoptium releases:

npm install
npm run generate

License

The JDK header files are subject to the GPLv2 with Classpath Exception license. See the NOTICE and/or LICENSE files in each version directory for details.

About

JNI headers, for use in cross-compilation build scripts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages