The Java Native Interface allows Java code to call native libraries written in C and C++. It is helpful when you need to do something that cannot be accomplished with Java alone.
We just released a massive 28-Hour course on the freeCodeCamp.org YouTube channel that will take you from beginner to expert with the Java Native Interface.
This course is from Java for Engineers. They have created a bunch of high-quality Java tutorials.
Here are all the section covered in this comprehensive course.
- Introduction to Java Native Interface (JNI)
- A Simple Java/C++ Project in NetBeans IDE
- A Closer Look at JNI Header Files
- Setting up C/C++ Development in Eclipse IDE
- Configuring External Tool to Generate Header Files
- Exporting Java Project to jar File With Dynamic Libraries
- Configuring External Tool for JDK 9 or Later
- Overloading Native Methods
- Overriding Native Methods
- Signature of Overloaded Native Methods in C++ (Part 1)
- Signature of Overloaded Native Methods in C++ (Part 2)
- Order of Execution for Static Initializers in the Class Hierarchy
- Working with JNI Primitive Types
- Working with Primitive Arrays
- Working with Object Arrays
- Working with Strings
- Accessing Instance Fields of a Java Class in C/C++
- Accessing Static Fields of a Java Class in C/C++
- Setting Fields of Java Class in C++
- Local Caching of Field IDs in C++
- Global Caching of Field IDs in C++
- Calling Instance Methods of a Java Class in C/C++
- Calling Static Methods of a Java Class in C/C++
- Calling Methods of a Java Interface in C++
- Creating and Returning Java Objects from C++ Code
- Downloading and Installing GNU Scientific Library (GSL)
- A Simple Example of Java/C++ Library Linking
- Working with Boxed Primitives (Wrappers) and List E in C++
- Nonvirtual Call of Methods of a Java Class in C++
- Linking Against Static C++ Libraries
- Working with Generic (Parameterized) Methods
- Working with Generic (Template) Classes
- Working with Java Reflection API (Method & Field) in C++
- Working with Java Constants (static final) in C++
- Using Fortran Libraries
- Generating Header files for Nested Inner Classes
- Instantiating Nested Inner Classes in C++
- Implementing Native Methods of Inner Classes
- Implementing Native Methods of Method-Local Inner Classes
- Managing Native Resources with JNI
- Resolving Native File Stream Conflicts
- Working with Standard Input
- Working with Standard Output
- The "auto" Keyword in C++
- Don't Locally Cache jclass When Creating New Objects in C++
- JNI Development on Windows Operating System
- C++ Debug vs. Release Compilation Mode
- Working with Maven Build
- Distributing C++ Source Code of JNI Project
- JNI Development on Linux Operating System
- Implementing Native Methods of Anonymous Classes
- Regular vs. Critical Access to Primitive Arrays in C++
- Regular vs. Critical Access to Java Strings in C++
- Creating and Working With an "Unsafe" Class
- The Power of "RegisterNatives" Function of JNI
- Working with JNI Without Creating Any Header Files
- Solving the Refactoring Problem Once and For All
- Using JAR files in C++
- Understanding javap tool
- C++ Classes and Structs in Java
- Handling Java Exceptions
Watch the full two-part course on the freeCodeCamp.org YouTube channel (28-hour watch).