jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes evaluating string expressions in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "evaluating string expressions in Java" Watch "evaluating string expressions in Java" New topic

evaluating string expressions in Java

Yatharth Kumar

Joined: Dec 06, 2002
Posts: 14
I am looking at usage of javascript eval method from within a java application to evlauate javascript expressions. Its works with JSObject, but the problem is I cant figure out how to obtain an instance of JSObject from a Java Class which is not an applet.
I dont want to use anything that will increase the size of the app. by more than 10 KB - why should I include complete JS engine if I all I want to do is eval!
Any help would be greatly appreciated !
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
There is nothing of the kind in the Java platform itself. You could write an expression evaluator yourself, or hunt down one that fits the bill; there are plenty around, varying from simple and small ones that consist of a single java file to complete scripting languages such as JavaScript, BeanShell, Jython or JRuby; see Programming Languages for the Java VM for more details than you ever wanted to know.
- Peter
I agree. Here's the link: http://aspose.com/file-tools
subject: evaluating string expressions in Java
Similar Threads
Check for existance of JSObject document
JSObject and Security
include Netscape package in CLASSPATH
Escape XML special characters?
Why to use eval function inside Javascript