Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call Javascript methods from Java

 
Alok Panda
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I have a requirement where I need to invoke Javascript methods from a Java file located in the same machine. Are there any possible solutions for this?

Regards,
Alok
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use the Java Scripting engine to invoke the JavaScript.

http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This article may interest you.
 
Alok Panda
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to you both. You both refer to the same article.
The article definitely helps, but we are using Java 5 and not Java 6

Regards,
Alok
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are using Java 5 and not Java 6

In that case BSF is for you. Or you can use the Rhino JavaScript engine directly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic