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 2525 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: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |