472,982 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 software developers and data experts.

Error in Running Converted JavaClass File From Java Script(Hello World Application)

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".

Expand|Select|Wrap|Line Numbers
  1. import org.mozilla.javascript.*;
  2. import org.mozilla.javascript.optimizer.OptRuntime;
  3.  
  4. public class Hello extends NativeFunction
  5. implements Script
  6. {
  7.  
  8. private int _id;
  9. private Hello _dcp;
  10. private Object _re[];
  11.  
  12. public Hello()
  13. {
  14. _id = 0;
  15. }
  16.  
  17. public static void main(String args[])
  18. {
  19. OptRuntime.main(new Hello(), args);
  20. }
  21.  
  22. public final Object exec(Context context, Scriptable scriptable)
  23. {
  24. return call(context, scriptable, scriptable, null);
  25. }
  26.  
  27. public final Object call(Context context, Scriptable scriptable, Scriptable scriptable1, Object aobj[])
  28. {
  29. if(!ScriptRuntime.hasTopCall(context))
  30. {
  31. return ScriptRuntime.doTopCall(this, context, scriptable, scriptable1, aobj);
  32. } else
  33. {
  34. return _c0(this, context, scriptable, scriptable1, aobj);
  35. }
  36. }
  37.  
  38. public int getLanguageVersion()
  39. {
  40. return 0;
  41. }
  42.  
  43. public String getFunctionName()
  44. {
  45. return "";
  46. }
  47.  
  48. public int getParamCount()
  49. {
  50. return 0;
  51. }
  52.  
  53. public int getParamAndVarCount()
  54. {
  55. return 0;
  56. }
  57.  
  58. public String getParamOrVarName(int i)
  59. {
  60. return null;
  61. }
  62.  
  63. public String getEncodedSource()
  64. {
  65. return "\207'^<html>\n<body>\n<script type=\"text/javascript\">\nalert(\"Hello World!\")" +
  66. ";\n</script>\n</body>\n</html>Q\001"
  67. .substring(0, 99);
  68. }
  69.  
  70. public boolean getParamOrVarConst(int i)
  71. {
  72. return false;
  73. }
  74.  
  75. private static Object _c0(Hello hello, Context context, Scriptable scriptable, Scriptable scriptable1, Object aobj[])
  76. {
  77. ScriptRuntime.initScript(hello, scriptable1, context, scriptable, false);
  78. Object obj = Undefined.instance;
  79. obj = ScriptRuntime.newObject(ScriptRuntime.name(context, scriptable, "XML"), context, scriptable, new Object[] {
  80. "<html>\n<body>\n<script type=\"text/javascript\">\nalert(\"Hello World!\");\n</s" +
  81. "cript>\n</body>\n</html>"
  82.  
  83. });
  84. return obj;
  85. }
  86. }
  87.  
Apr 9 '09 #1
0 2525

Sign in to post your reply or Sign up for a free account.

Similar topics

13
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?...
2
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...
1
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...
4
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?
3
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):...
2
Saghar
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...
21
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!
8
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...
1
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.
2
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...
0
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=()=>{
2
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...
2
isladogs
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...
0
tracyyun
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...
2
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...
3
NeoPa
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...
1
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...
0
isladogs
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.