Skip to content
brett hartshorn edited this page Feb 20, 2015 · 5 revisions

Calling Java from Rusthon

The JavaVM library can be linked with your output exe by using import jvm, and java classes exposed by wrapping them in XML using Giws. https://github.com/opencollab/giws/

import the jvm module and load the java packages with jvm.namespace to import those classes into this namespace.

import jvm
jvm.namespace('org.mypackage')

java objects are created by calling the jvm module.

ob = jvm(MyJavaClass())

https://github.com/rusthon/Rusthon/blob/master/examples/java_giws.md

Experimental - Java to Rusthon Translation

you will need our fork of java2python configured to output Rusthon syntax. requires python2.

cd
git clone https://github.com/rusthon/java2python.git
cd java2python
sudo python setup.py install
cd
wget http://www.antlr3.org/download/antlr-3.1.3.tar.gz
tar xfz antlr-3.1.3.tar.gz
cd antlr-3.1.3/runtime/Python/
sudo python setup.py install

Java to Rusthon

rusthon.py will convert java code in a markdown using java2python. classes from java can be used from Rusthon code with the c++ backend.

./rusthon.py ./examples/hello_java.md

Sidebar

Clone this wiki locally