This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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
Posts: 42968
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