Java API generator

Java API generator (scapix_java executable in bin folder) is used to generate C++ headers from Java binary *.class files. Scapix comes with pre-generated C++ headers for jdk-11.0.2 and android-28 (folder scapix/java_api). For example, see generated C++ header: java/lang/String.h.

Generating additional Java API C++ headers

You can also use scapix_java to generate C++ headers for another JDK or Android release or for any other Java code, including your own. This is how you can generate Java API C++ headers for a different Java target, in this example android-14 API. Install corresponding Java SDK (for example using Android Studio SDK Manager). You may have to adjust path to Android SDK depending on your system.

Windows:

cd scapix\java_api
mkdir android-14\scapix\java_api
cd android-14\scapix\java_api
unzip "%USERPROFILE%\AppData\Local\Android\Sdk\platforms\android-14\android.jar" -d temp
scapix-bin\Windows-AMD64\scapix_java temp
rmdir /s/q temp

macOS:

cd scapix/java_api
mkdir -p android-14/scapix/java_api
cd android-14/scapix/java_api
unzip "~/Library/Android/sdk/platforms/android-14/android.jar" -d temp
scapix-bin/Darwin-x86_64/scapix_java temp
rm -rf temp

Linux:

cd scapix/java_api
mkdir -p android-14/scapix/java_api
cd android-14/scapix/java_api
unzip "~/Android/Sdk/platforms/android-14/android.jar" -d temp
scapix-bin/Linux-x86_64/scapix_java temp
rm -rf temp

Now when running CMake for a project using Scapix, you can specify SCAPIX_JAVA_API=android-14.