anja

package module
v0.22.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: BSD-3-Clause Imports: 0 Imported by: 0

README

anja

Added JVM desktop binding support.

New desktop/JVM packaging

anja bind now supports building desktop JVM artifacts in two ways:

  1. -target=android -desktop: also builds a desktop JAR in addition to the Android AAR.

  2. -target=jvm: builds only the desktop JAR (no AAR output).

Basic usage

Build only desktop JAR:

anja bind -target=jvm ./your/pkg

Set JAR output path:

anja bind -target=jvm -o mylib.jar ./your/pkg

Build Android AAR + desktop JAR together:

anja bind -target=android -desktop -o mylib.aar ./your/pkg
Desktop target selection

Use -desktoptargets to control native platforms included in the desktop JAR.

Default:

-desktoptargets=host

Example:

anja bind -target=jvm \
  -desktoptargets host,linux/amd64,darwin/arm64,windows/amd64 \
  -jniinclude /path/to/jni-headers \
  -desktopo mylib-desktop.jar \
  ./your/pkg
Custom JNI headers

Use -jniinclude when the JNI headers for desktop builds should come from a specific directory instead of the default JAVA_HOME lookup.

Directory layout:

/path/to/jni-headers/
├── jni.h
├── darwin
│   └── jni_md.h
├── linux
│   └── jni_md.h
└── win32
    └── jni_md.h

Example:

anja bind -target=jvm \
  -jniinclude /path/to/jni-headers \
  ./your/pkg

Lookup order for each desktop target:

  • First check <jniinclude>/jni.h and <jniinclude>/<os>/jni_md.h.
  • os maps to linux, darwin, or win32.
  • If the configured directory does not contain matching JNI headers, fall back to the existing JAVA_HOME / javac detection.

Supported target syntax:

  • host
  • linux or linux/<arch>
  • darwin or darwin/<arch>
  • windows or windows/<arch>

Supported desktop arches by platform:

  • Linux: 386, amd64, arm, arm64
  • macOS: amd64, arm64
  • Windows: 386, amd64, arm64

Notes

  • Desktop builds require a full JDK (JNI headers), usually via JAVA_HOME.
  • Use -jniinclude to point desktop builds at a custom JNI headers directory. anja checks <root>/<os>/ first and falls back to the existing JAVA_HOME detection when the platform headers are not present.
  • Cross-platform desktop builds require matching C cross-compilers/toolchains installed.

Documentation

Index

Constants

View Source
const Stub = 0

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package asset provides access to application-bundled assets.
Package asset provides access to application-bundled assets.
Package bind implements a code generator for anjb.
Package bind implements a code generator for anjb.
java
Package java implements the Java language bindings.
Package java implements the Java language bindings.
objc
Package objc implements the Objective-C language bindings.
Package objc implements the Objective-C language bindings.
seq
Package seq implements the machine-dependent seq serialization format.
Package seq implements the machine-dependent seq serialization format.
cmd
anja command
Anja is a tool for building and running mobile apps written in Go.
Anja is a tool for building and running mobile apps written in Go.
anjb command
Anjb generates language bindings that make it possible to call Go functions from Java and Objective-C.
Anjb generates language bindings that make it possible to call Go functions from Java and Objective-C.
internal
binres
Package binres implements encoding and decoding of android binary resources.
Package binres implements encoding and decoding of android binary resources.
importers
The importers package uses go/ast to analyze Go packages or Go files and collect references to types whose package has a package prefix.
The importers package uses go/ast to analyze Go packages or Go files and collect references to types whose package has a package prefix.
importers/java
The java package takes the result of an AST traversal by the importers package and queries the java command for the type information for the referenced Java classes and interfaces.
The java package takes the result of an AST traversal by the importers package and queries the java command for the type information for the referenced Java classes and interfaces.
importers/objc
The objc package takes the result of an AST traversal by the importers package and uses the clang command to dump the type information for the referenced ObjC classes and protocols.
The objc package takes the result of an AST traversal by the importers package and uses the clang command to dump the type information for the referenced ObjC classes and protocols.
mobileinit
Package mobileinit contains common initialization logic for mobile platforms that is relevant to both all-Go apps and anjb-based apps.
Package mobileinit contains common initialization logic for mobile platforms that is relevant to both all-Go apps and anjb-based apps.
sdkpath
Package sdkpath provides functions for locating the Android SDK.
Package sdkpath provides functions for locating the Android SDK.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL