1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
Java support for Entity
Doug McBride <doug-entity@sneakyfrog.com>
2001.04.30
======================================================================
I'm in the process of adding Java support to Entity. It's a mess right
now, but I'm checking in what I have in case anyone wants to play with it
(or fix parts of it :)
======================================================================
+ What works
+ Embedding java code in <?java ?> tags
- <object> <?java System.out.println("Hi mom."); ?> </object>
- we use the beanshell interpreter (http://www.beanshell.org)
- any valid beanshell expression should work (java plus some shortcuts)
+ Calling java functions from entity with no arguments
- example:
<object>
<window>
<button label="Click me!" onclick="java:clicked"/>
<?java
System.out.println("Java interpreter is working.");
clicked(String enode)
{
System.out.println("click.");
}
?>
</window>
</object>
- java functions must take one parameter, a
java.lang.String object. Nothing useful is passed
as an argument right now. the clicked() function
above doesn't require q return type since we're using
beanshell.
+ What doesn't work
+ Enode access from Java
- This is the next thing to work on.
+ non-Linux platforms?
- I didn't do anything that shouldn't work on
other platforms, but my guess is that there will
be some issues.
+ Magic Makefile creation
- Right now the Makefile is a hard-coded hack based on
src/renderers/javascript/Makefile.
- It's icky.
+ How to build
- Download http://www.beanshell.org/bsh-1.01.jar
or get the source and build your own.
- Your CLASSPATH must contatin bsh-1.01.jar (from a
built beanshell release)
- Your CLASSPATH must also contatin src/renderers/java because
that's where the built Entity Java classes are being put for now.
- Environment variable JAVA_HOME must be set to the root of
your JDK. I'm using Sun's 1.3.1 version but any decent Java
1.2 JDK should work.
- after building the rest of entity, cd into src/renderers/java
and do "make"
- copy (or link) the resulting librendjava.la and
.libs/librendjava.so into usr/local/lib/entity/clib/
- try to run "entity src/t/java.e" as a test.
|