Skip to content

brandonbloom/terra-java

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Terra-Java

Raw JNI too cumbersome? JNA not fast enough? C++ code generators make you sad?

Try Terra-Java!

Abstract

Terra-Java leverages Terra's metaprogramming facilities to enable you to define native JVM extensions with unprecedented ease.

JNI boilerplate is automatically generated during Terra compilation.

Just as Terra can generate native code without a runtime Lua dependency, Terra-Java can generate JVM extensions without a Terra-Java dependency.

Status

This project is a work-in-progress. Some things do not work as advertised yet.

Quick Start

Dependencies & Configuration

Install Terra 2016-03-25 and the JDK, then set the following environment variables:

  • INCLUDE_PATH: Terra looks here for standard C headers.
  • JDK_HOME: Terra-Java looks here for Java headers and libjvm.

To use Terra-Java from your own Terra project, add a pattern for the directory containing terra-java.t to one additional environment variable:

  • TERRA_PATH: Terra's version of LUA_PATH. Use ;; for the default value.

For example:

TERRA_PATH=/some/path/to/terra-java/?.t;;

Build

Compile the Terra-Java support libraries and examples:

./build.sh

Running Examples

Run Terra code that interops with the JVM:

terra ./terra-java/examples/interop.t
terra ./terra-java/examples/extension/native.t

Run JVM code that utilizes native extensions:

java \
  -Djava.class.path=./obj \
  -Djava.library.path=./obj \
  terrajava.examples.extension.Accumulator

Usage

Check out the examples, then see the guide for many more details

About

Lua/Terra + Java Native Interface

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published