What is the best way to run JavaScript in Java?

I looking for the best way to obtain JSON data, that polling from server to JS (generated by DWR) in the client-side. So I going to make Java-client for it. Any ideas and advices about it are greatly appreciated.

UPDATE: Primary goal - to understand how I can intercept JSON data transmitted from server (like in the Firebug). On the server-side - DWR (JSP pages), on the client-side - JS that generated by server. This scheme works with long-polling.


There is a JavaScript implementation for Java called Rhino (from Mozilla). I think it's in the JDK since version 1.6. You can run JavaScript with it in your Java program (here is a small tutorial for it, you will find more on google).

Why not use a JSON parsing library for Java like Jackson ?

Or you could make a webclient since this is obviously the purpose of the generated JS.

Need Your Help

How to keep multiple read/write DB servers in sync?

database load-balancing

I'm curious to know how big sites spread the load between the different DB server in the case where users write as much as they read, ie. when the standard solution of having one master to accept w...

How to rename my CVS project?


I just started using CVS to manage my source files. After finishing my school assignment, I found out that I had used the wrong project name in my cvsroot. Since the submit system is looking for a