This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

evaluating string expressions in Java

 
Yatharth Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,
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 !
thanks,
Y
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic