Hi,
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 by Rhino Java Script Compiler.But now i am facing 1 more problem.i want to run that java class in IntelliJIdea.but its runnig with no error and not getting the out put.This is the converted java class for printing "HelloWorld". -
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;
-
}
-
}
-
0 2551 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Charles Handy |
last post by:
How does FastCGI compare against java Apps running in java app servers
like TomCat, Sun One, WebLogic and WebSphere? Is there a business case
for switching from CGI to Java? Performance?...
|
by: Begoña |
last post by:
in my java application I've made a call to this stored procedure
CREATE procedure pruebaICM
@pANI varchar(20),
@pTABLA varchar(20),
@pInsert varchar(500),
@pUpdate varchar(1000),
@pFLAG...
|
by: sandyde2 |
last post by:
Hi all,
I am writing a java application as a mozilla extension.
Because mozilla uses javascript for the frontend,
i need the javascript to call my external java application
and pass one...
|
by: sai |
last post by:
Hi.. Thanks to all
I am a fresher want to build my carrier in programming field ..
please give me u r valuable suggisition .. that.. how can i build my
career in java world?
|
by: Gary Wessle |
last post by:
thanks for helping with this problem
I am getting errors starting with
fred@debian:~/myPrograms/cpp/practice$ make
cc hello.cpp
/tmp/ccQzQfGH.o: In function `main':
hello.cpp:(.text+0x27):...
|
by: Saghar |
last post by:
Hi,
Could somebody help me about this topic? I want to know how we can call and execute a non-java source file in a java application. For example, a simple Java application is run, there is an...
|
by: ding |
last post by:
I am facing problem to writting file to MySQL database in java application. Can show me a example code? Thanks!
|
by: Ananthu |
last post by:
Hi
I have done all the codings part for connecting mysql with java in eclipse environment.
Coding Part:
import java.sql.Connection;
import java.sql.DriverManager;
public class...
|
by: tinmaung |
last post by:
hi
please help me
i want to know how to play sound in java application
i don't mean java applet
if you can, please send me how to write coding to play sound in application.
|
by: babp |
last post by:
Hi Iam new to perl and need a help to send inputs to an running application :
I am running an application XXXX , and when it starts i am passing a file name called "connect.spb" and after the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
| |