I am trying to compile this on Blackberry 4.5 JDE. I added the Jar file to the project with a simple Hello World BB app that does not use Rhino. So basically, it is just verifying the small Jar. I get the errors below using the version of Rhino you did. Are you using the latest J2ME? I see java.lang.reflect and java.lang.ClassLoader as the major hurdles here. The other classes I may be able to pull out of the JDK sources, but those two depend on a lot of other classes.
Tony Z Building Rhino C:\BlackBerryJDE4.5.0\bin\rapc.exe -quiet import=..\..\lib\net_rim_api.jar library=Rhino Rhino.rapc warnkey=0x52424200;0x52525400;0x52435200 "C:\Documents and Settings\mtzakula\My Documents\NetBeansProjects\smalljs.jar" java.io.Serializable: Warning!: No definition found org.mozilla.javascript.ScriptableObject: Warning!: Implements undefined interface: java.io.Serializable java.lang.ClassLoader: Warning!: No definition found java.util.Locale: Warning!: No definition found java.lang.reflect.Field: Warning!: No definition found org.mozilla.javascript.IdScriptableObject$PrototypeValues: Warning!: Implements undefined interface: java.io.Serializable java.lang.reflect.Method: Warning!: No definition found java.lang.Cloneable: Warning!: No definition found org.mozilla.javascript.Interpreter$CallFrame: Warning!: Implements undefined interface: java.lang.Cloneable org.mozilla.javascript.Interpreter$CallFrame: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.Interpreter$ContinuationJump: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.InterpreterData: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.MemberBox: Warning!: Implements undefined interface: java.io.Serializable java.lang.reflect.Member: Warning!: No definition found java.text.DateFormat: Warning!: No definition found org.mozilla.javascript.NativeGlobal: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.NativeJavaObject: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.NativeWith: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.ObjArray: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.ObjToIntMap: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.Ref: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.ScriptableObject$Slot: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.UintMap: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.Undefined: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.UniqueTag: Warning!: Implements undefined interface: java.io.Serializable java.lang.ThreadLocal: Warning!: No definition found java.lang.reflect.InvocationHandler: Warning!: No definition found org.mozilla.javascript.jdk13.VMBridge_jdk13$1: Warning!: Implements undefined interface: java.lang.reflect.InvocationHandler org.mozilla.javascript.regexp.RECharSet: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.regexp.RECompiled: Warning!: Implements undefined interface: java.io.Serializable org.mozilla.javascript.Arguments: Error!: Missing stack map at label: 88 Error while building project On Tue, Feb 1, 2011 at 10:59 AM, Jürg Lehni <[email protected]> wrote: > 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
