...

View Full Version : Calling own Java code from Javascript.



enderp
03-18-2012, 05:32 PM
Hello, I'm making a Javascript implementation for my Java program. But I'm having a proplem. I want to call my own Java code from the Javascript script.
Is that possible?

Thanks,
enderp

Philip M
03-18-2012, 05:36 PM
Hello, I'm making a Javascript implementation for my Java program. But I'm having a proplem. I want to call my own Java code from the Javascript script.
Is that possible?

Thanks,
enderp

Google is your friend!

http://www.rgagnon.com/javadetails/java-0170.html
http://www.woodger.ca/js_jvint.htm

It is your responsibility to die() if necessary….. - PHP Manual

enderp
03-18-2012, 05:43 PM
Google is your friend!

http://www.rgagnon.com/javadetails/java-0170.html

It is your responsibility to die() if necessary….. - PHP Manual
I've seen that one, but it doesn't show how to call your own packaged Java code.
I have the js files in the script directory, and the java classes in the bin directory.
http://desmond.imageshack.us/Himg72/scaled.php?server=72&filename=screenshotat20120318174.png&res=medium

Look, it's not for web development, but scripting for a game.

Old Pedant
03-19-2012, 12:06 AM
The JavaScript code doesn't really care where the Java comes from. The Java *must* already be present on the page for JavaScript to call it.

The <applet> tag allows you to specify the path to your JS class and, at the same time, give the applet a name= that can be seen by JavaScript. JavaScript refers to the applet by the name= value and is unaware of the actual .class file being used.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum