MyNixOS website logo
Description

Bindings to the JNI and a high level interface generator.

This package offers bindings to the Java Native Interface and a high level interface generator.

low level bindings to the JNI

The low level bindings are located in Foreign.Java.JNI.Safe and Foreign.Java.JNI.Unsafe. When using these bindings you will have to deal with pointers and manage global references manually.

medium level interface

The medium level interface is located in Foreign.Java. It offers an abstraction over the JNI, i.e. you will not have to deal with pointers explicitly nor do you need to manually do conversions between native types and Haskell types. Also references will automatically be released by the Haskell runtime when no longer needed. You will still need to manually lookup classes and methods in order to use them.

high level bindings generator

You can also generate high level bindings using the tools j2hs and hs2j that come along with this package. The tools works in both directions, i.e. you can generate glue code to use existing Java libraries from within Haskell as well as to use Haskell from within Java. This is the most convenient way to deal with a Java library.

>>> INSTALLATION / USAGE

It should suffice to do cabal install (or cabal install java-bridge when installing from hackageDB). /You need to have a JDK installed prior to installing this library/.

Setup will try to find the location of your java installation automatically. This is needed in order to load libjvm. Note that this library is loaded dynamically, which means that linking errors might not show up during installation.

You can specify the location of libjvm manually using the environment variable FFIJNI_LIBJVM. This environment variable is consulted by Setup.hs as well as by the library each time libjvm is loaded - which means that you can override the path to libjvm at any time. The function getCompiledLibjvmPath in Foreign.Java.JNI.Safe will tell you what path to libjvm has been set during compilation of the library.

>>> FUN WITH (cabal-) FLAGS

The following cabal flags are available to you for configuring your installation:

ONLY_CORE

Build only the Core Modules which offer a direct binding to the Java Native Interface. The core modules are Foreign.Java.JNI, Foreign.Java.JNI.Safe, and Foreign.Java.JNI.Unsafe. This implies NO_TOOLS. Defaults to False.

NO_TOOLS

Do not build the j2hs and hs2j executables. Defaults to False.

DEBUG

Enable a debug build. Defaults to False.

OSX_GUI

Build the library with special support for Cocoa on Mac OS X (you will not be able to use AWT or Swing without). Defaults to True on Darwin (OS X).

OSX_FRAMEWORK

Use the JavaVM framework on MacOS X instead of loading the dynamic library. Defaults to False. Enable this flag if building on your OS X machine fails. Defaults to False.

EXAMPLES

Build a set of examples. They are prefixed with java- and located along your haskell executables. Defaults to False.

Use for example cabal install -f OSX_FRAMEWORK -f EXAMPLES or cabal configure -f DEBUG.

>>> HACKING

See HACKING.txt and ISSUES.txt in the tar.gz-package.

java-bridge.

Metadata

Version

0.20130606.3

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows