Results 1 to 2 of 2
  1. #1
    tosreejith is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default I am not able to Run Converted JavaClass File From Java Script

    My first problem was i am not able to compiled a file from java script to java class.Now its clear and working fine..now i can convert a java script file to java class.But now i am facing 1 more problem.i want to run that java class in IDE IntelliJIdea.but its runnig with no error but not getting the out put.This is the converted java class for printing "HelloWorld".


    Java Code:
    import org.mozilla.javascript.*;
    import org.mozilla.javascript.optimizer.OptRuntime;
    
    public class Hello extends NativeFunction
        implements Script
    {
    
        private int _id;
        private Hello _dcp;
        private Object _re[];
    
        public Hello()
        {
            _id = 0;
        }
    
        public static void main(String args[])
        {
            OptRuntime.main(new Hello(), args);
        }
    
        public final Object exec(Context context, Scriptable scriptable)
        {
            return call(context, scriptable, scriptable, null);
        }
    
        public final Object call(Context context, Scriptable scriptable, Scriptable scriptable1, Object aobj[])
        {
            if(!ScriptRuntime.hasTopCall(context))
            {
                return ScriptRuntime.doTopCall(this, context, scriptable, scriptable1, aobj);
            } else
            {
                return _c0(this, context, scriptable, scriptable1, aobj);
            }
        }
    
        public int getLanguageVersion()
        {
            return 0;
        }
    
        public String getFunctionName()
        {
            return "";
        }
    
        public int getParamCount()
        {
            return 0;
        }
    
        public int getParamAndVarCount()
        {
            return 0;
        }
    
        public String getParamOrVarName(int i)
        {
            return null;
        }
    
        public String getEncodedSource()
        {
            return "\207'^<html>\n<body>\n<script type=\"text/javascript\">\nalert(\"Hello World!\")" +
    ";\n</script>\n</body>\n</html>Q\001"
    .substring(0, 99);
        }
    
        public boolean getParamOrVarConst(int i)
        {
            return false;
        }
    
        private static Object _c0(Hello hello, Context context, Scriptable scriptable, Scriptable scriptable1, Object aobj[])
        {
            ScriptRuntime.initScript(hello, scriptable1, context, scriptable, false);
            Object obj = Undefined.instance;
            obj = ScriptRuntime.newObject(ScriptRuntime.name(context, scriptable, "XML"), context, scriptable, new Object[] {
                "<html>\n<body>\n<script type=\"text/javascript\">\nalert(\"Hello World!\");\n</s" +
    "cript>\n</body>\n</html>"
    
            });
            return obj;
        }
    }

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Firstly, why?
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

Similar Threads

  1. Using Script src with a variable file name
    By Sidders at CHEP in forum New To Java
    Replies: 6
    Last Post: 03-03-2009, 05:18 PM
  2. How build the applicatoin by using Batch file script
    By Kishore.Kumar in forum Eclipse
    Replies: 0
    Last Post: 02-11-2009, 08:42 AM
  3. Replies: 4
    Last Post: 03-25-2008, 12:16 PM
  4. Problem creating a Post script file
    By krishnan.1000 in forum New To Java
    Replies: 0
    Last Post: 02-14-2008, 07:15 PM
  5. Replies: 3
    Last Post: 10-31-2007, 11:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •