File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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:
subject: evaluating string expressions in Java
jQuery in Action, 3rd edition