On Mar 29, 11:33 pm, ridpi...@hotmail.com wrote:
..
> I'm looking for an alternative to lua.
Never heard of it. Do you mean this?
<http://www.keplerproject.org/luajava/>
> I first though LuaJava would do the trick, but since LuaJava needs the
> native calls to the lua c library, I can't use it for my Java clients.
Why not?
> I can distribute the c native lua to my c++ clients, but my Java
> clients need to run "pure java".
Why?
Andrew T.
Oliver Wong - 29 Mar 2007 15:54 GMT
> On Mar 29, 11:33 pm, ridpi...@hotmail.com wrote:
> ..
>> I'm looking for an alternative to lua.
>
> Never heard of it. Do you mean this?
> <http://www.keplerproject.org/luajava/>
Lua is a scripting language like Python. I'd never heard of LuaJava
before, but I suspect it's an implementation of Lua in Java, much like
Jython is a Python implementation in Java.
>> I first though LuaJava would do the trick, but since LuaJava needs the
>> native calls to the lua c library, I can't use it for my Java clients.
[...]
>> I can distribute the c native lua to my c++ clients, but my Java
>> clients need to run "pure java".
How about Jython?
http://www.jython.org/Project/index.html
<quote>
Jython is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated with
the Java platform. It thus allows you to run Python on any Java platform.
</quote>
There's also JRuby, and probably a couple of .NET -> JVM bridges.
- Oliver
> My problem is that I need to send scripts to multiple clients, where
> some are developed in c++ and some in Java. I would like to find an
[quoted text clipped - 3 lines]
> I can distribute the c native lua to my c++ clients, but my Java
> clients need to run "pure java".
Oliver has already mentioned Python, which has a Java-only variant in JPython.
(I'm not sure how easy it is to use the standard Python implementation as an
embedded scripting language, but it is certainly very possible to use JPython).
JavaScript/ECMAScript has widely used C and Java implementations in
SpiderMonkey and Rhino respectively. (The last time I looked -- several years
ago -- the SpiderMonkey code wasn't completely thread-safe, but it wasn't
difficult to make it so.) Apparently Java 1.6 comes with a cut-down Rhino in
the box[*].
If you want to use a language from the Lisp family, then you'll have little
difficulty finding embeddable versions for both implementation languages. I
don't know whether you'll be able to find two packages which implement
sufficiently similar dialects, but it isn't obviously unlikely (depending on
what you want to do).
If you /really/ need the two languages to be identical in both incarnations,
then you could consider using JNI to embed a Java-based implementation into the
C version of your applications. (You say that your Java application needs to
be "pure Java", but I don't know whether the reverse is also true).
-- chris
[*] A sentence that not everyone gets the chance to use...
ridpiska@hotmail.com - 30 Mar 2007 21:30 GMT
Hi
Thank you all for very interesting answers. I'll take a closer look at
Jython, but from my first glance at their documentation I'm afraid it
won't quite fit.
As a browse through different script languages I realise more what I
need:
I need to be able to send script to my clients that call methods
within my clients, and the scripts should be able to receive the
results and act upon it (the same script must be able to run on both
the c++ client and the Java client).
I'm stuck with Java 1.5, and I cannot use jni (in any direction), but
it was a good thought Chris.
The more I read the more I'm staring to think of implementing an
script interpretator by myself (one in the c++ client, and one in the
java client).
I'm sorry I cannot provide you with more details of my clients.
thank you for your helpful answers
cheers
/ jonas
On 30 Mar, 07:15, "Chris Uppal" <chris.up...@metagnostic.REMOVE-
THIS.org> wrote:
> ridpi...@hotmail.com wrote:
> > My problem is that I need to send scripts to multiple clients, where
[quoted text clipped - 29 lines]
>
> [*] A sentence that not everyone gets the chance to use...
Oliver Wong - 02 Apr 2007 14:50 GMT
> I'm stuck with Java 1.5, and I cannot use jni (in any direction), but
> it was a good thought Chris.
I believe JNI is available in Java 1.5 (i.e. it isn't a feature that
was newly introduced in 1.6 or anything like that).
> The more I read the more I'm staring to think of implementing an
> script interpretator by myself (one in the c++ client, and one in the
> java client).
Good luck.
- Oliver
Steve Wampler - 02 Apr 2007 17:52 GMT
>> I'm stuck with Java 1.5, and I cannot use jni (in any direction), but
>> it was a good thought Chris.
>
> I believe JNI is available in Java 1.5 (i.e. it isn't a feature that
> was newly introduced in 1.6 or anything like that).
It is, and 1.4, and 1.3...

Signature
Steve Wampler -- swampler@noao.edu
The gods that smiled on your birth are now laughing out loud.