forked from jnode/jnode
- Notifications
You must be signed in to change notification settings - Fork 0
Class Library
Levente Santha edited this page May 9, 2026
·
1 revision
JNode implements the standard Java class library by integrating and patching GNU Classpath and OpenJDK.
Because JNode is an operating system that runs directly on hardware (without a host OS like Linux or Windows), standard Java library calls that typically rely on OS-level native methods (like Thread.start(), System.out.println(), or file I/O) cannot work out of the box.
To provide a fully compliant Java environment, JNode downloads standard class library jars during the build process and layers its own custom VM-specific implementations on top of them.
| Class / File | Role |
|---|---|
core/src/classpath/vm/ | JNode's custom implementations of GNU Classpath VM classes. |
core/src/openjdk/vm/ | JNode's custom implementations of OpenJDK VM classes. |
all/lib/classlib.jar | The downloaded base class library (managed by the build system). |
- Base Libraries: During
sh build.sh, the build system downloads the required base standard libraries (e.g., a pre-compiled GNU Classpath or OpenJDK jar) toall/lib/classlib.jarif they are not already present. - VM Overrides: Classes inside
core/src/classpath/vm/andcore/src/openjdk/vm/replace or supplement the standard implementations. For instance, JNode provides its ownjava.lang.VMThreadandjava.lang.VMSystemwhich interface directly with the JNode kernel and scheduler rather than making native OS calls. - Boot Image Generation: The
BootImageBuilderweaves these standard classes and JNode's VM-specific overrides together into the final boot image, replacing native method bindings with JNode's own magic or Java-based native implementations.
- No Native OS Methods: You cannot use JNI to call C/C++ libraries. Any "native" method in standard Java classes must have a JNode-specific implementation, typically handled via
@MagicPermissionor written purely in Java usingVmMagic. - Finding the Source of Truth: If you are debugging a standard Java class (like
java.io.File), checkcore/src/classpath/orcore/src/openjdk/first to see if JNode overrides its behavior. If it doesn't, the issue might be in the underlying downloadedclasslib.jaror in how JNode's JIT compiler processes it.