python eai for x3d proof of concept

jython also works for EAI (external authoring interface) for X3D browsers like instantplayer. this is a 5 minute proof of concept.

code example (HelloInstant.py):

from java.net import InetAddress
from vrml import *

      address = InetAddress.getByName(“localhost”)
browser = eai.BrowserFactory.getBrowser(address, 4848)

     print(browser.getName())

1. just download and install jython:
http://www.jython.org/Project/download.html

2. put you instantreality lib (instantreality.jar) into java classpath or modify the startup file (jython) in order to do so:

#!/bin/sh

# This file was generated by the Jython installer
# Created on Mon May 19 20:25:40 CEST 2008 by me

CP=”/Users/me/jython2.2.1/jython.jar:/Applications/Instant Player.app/Contents/MacOS/instantreality.jar
if [ ! -z “$CLASSPATH” ]
then
CP=$CP:$CLASSPATH
fi
“/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java” -Dpython.home=”/Users/me/jython2.2.1″ -classpath “$CP” org.python.util.jython “$@”

3. start the python file in your shell:

./jython HelloInstant.py