I have java API (jar), which contains more number of classes and methods. How can i import / refer java classes into javascript from a jar file. I referred many forums and sites but could not get the possible solutions. Any one suggest me to do this.

I have java API (jar), which contains more number of classes and methods. How can i import / refer java classes into javascript from a jar file.

If you're running the javascript in a browser, your only choice is to communicate with a backend server through HTTP or other available protocol. Of course this won't give you direct access to Java methods or classes.

Previous answers are correct in light of the little information we have. But:
If you talking about a web page containing javascript, this javascript code can communicate with a Java applet in the same page.

baftos wrote:
Previous answers are correct in light of the little information we have. But:
If you talking about a web page containing javascript, this javascript code can communicate with a Java applet in the same page.

Aha, but the question was: HOW ;)

Doing a google for "javascript invoke applet method" gives the answer quite quickly and completely. Either the OP is lying about his research actions, or he's not interested in applets.

Before going into this delicate matter, I wanted to know if it is browser JavaScript, which is the most common, but not only place where we can find JavaScript.
If, so, is the jar an applet or just a container of useful classes? If just a container, maybe it can be wrapped in an applet etc. etc. Just wanted to avoid useless talk before we know more about the context.

In my peoplesfot development, if i place Guiffy.jar file into %PS_HOME%\class directory and if i call that class which is embedded in jar, it will executed on application server in the same machine. But i want to execute that jar in webserver on client machine and finally display the result on client browser or GUI form of Guiffy. It should not be depend on application server. so i chose the option to call Guiffy class from javascript to execute on client side.