I can confirm this works, at least it seems to:

I just did tried this code on a device running J2ME CDC:

Context cx = Context.enter();
Scriptable scope = cx.initStandardObjects();
Object result = cx.evaluateString(scope, "10 + 10", "<test>", 1, null);
System.out.println(Context.toString(result));

And I got 20 on the console.

The Rhino.jar I produced on Mac, using the following commands in the Rhino1_6R5 
folder:

ant clean
ant -Ddebug=off -Dno-e4x=true smalljar

The resulting smalljs.jar has RegExp support built in and is only 266 kb in 
size.

I am now trying to find out what the latest version of Rhino is that is still 
compatible.

More on this soon.

Jürg

On 1 Feb 2011, at 15:39, Tony Zakula wrote:

> I will download that and try importing it into a J2ME project and see
> what happens.
> 
> Tony Z
> 
> 
> On Mon, Jan 31, 2011 at 5:09 PM, Jürg Lehni <[email protected]> wrote:
>> I am interested in a Rhino that works on J2ME CDC as well and just looked 
>> into this.
>> 
>> It appears that the Orbit project did not have to make any modifications to 
>> Rhino. At the time, Rhino 1.6 R5 seemed to be compatible with CDC.
>> 
>> I think Generics and other Java 5 modifications were added at a later point, 
>> thus breaking compatibility with CDC.
>> 
>> Jürg
>> 
>> On 31 Jan 2011, at 19:05, Raju Bitter wrote:
>> 
>>> Sun did a project with Laszlo Systems (OpenLaszlo platform) in
>>> 2006/2007, where they used Rhino to load an OpenLaszlo
>>> DHTML/JavaScript application into J2ME app. I remember that the
>>> engineer working on the project said that you'd have to at least use
>>> the CDC/PBP profile to get Rhino running. But I don't know what the
>>> requirements were for the functionality within J2ME (class loading,
>>> ...) You can check the source code of the project at
>>> http://java.net/projects/orbit/sources/svn/show
>>> 
>>> Project Orbit announcement
>>> http://weblog.openlaszlo.org/archives/2007/05/sun-launches-project-orbit/
>>> Personal Basis Profile http://java.sun.com/products/personalbasis/
>>> J2ME CDC 
>>> http://www.oracle.com/technetwork/java/javame/tech/index-jsp-139293.html
>>> 
>>> Don't know if this will help you. Good luck!
>>> 
>>> - Raju
>>> 
>>> On Sat, Jan 29, 2011 at 5:29 PM, Tony Zakula <[email protected]> wrote:
>>>> Hi,
>>>> 
>>>> I am looking at possibly attempting to port Rhino to J2ME.  J2ME is
>>>> basically a very stripped down version of J2SE and it is compatible
>>>> with Java 1.3.
>>>> 
>>>> The port would really only need basic JS functionality.  I need to
>>>> only run in interpreted mode so no class compiles are needed,  no
>>>> inheritance, and no implementing interfaces, no security controller,
>>>> etc.
>>>> 
>>>> After looking through the Rhino source code, I have a short list of
>>>> the issues I see.
>>>> 
>>>> 1. There is no reflection in 1.3.  I do need access to Java objects,
>>>> but I was thinking I could maybe write a simple bridge where instead
>>>> of putting Java objects into JS, one method was called with some
>>>> parameters and then the Java side would take those and do what it
>>>> needs to do and just return a string result that the task was done.
>>>> 
>>>> 2. ClassLoader is a problem for 1.3.  Maybe that can just be
>>>> eliminated because I do not need compiles?
>>>> 
>>>> 3. Generics, there is none in 1.3.  I would have to rewrite the Rhino
>>>> classes to take care of that?
>>>> 
>>>> 4. Missing JDK classes.  I would have to try to bring those in from SE
>>>> or write replacements.
>>>> 
>>>> I saw where I could compile the small to jar to prune some things I
>>>> would not need, and in a Rhino Ant Script, it looks like maybe you can
>>>> target 1.3 with a retrotranslater?
>>>> 
>>>> Even with that, I would manually need to prune those things because I
>>>> still need to know what I have to provide from SE.
>>>> 
>>>> It is likely, I will be able to open source this when and if it is
>>>> done.  I would appreciate any thoughts, comments, or advice.
>>>> 
>>>> Thanks!
>>>> 
>>>> Tony Z
>>>> _______________________________________________
>>>> dev-tech-js-engine-rhino mailing list
>>>> [email protected]
>>>> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>>>> 
>>> _______________________________________________
>>> dev-tech-js-engine-rhino mailing list
>>> [email protected]
>>> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>> 
>> 

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to