User Tools

Site Tools


blogtng:2011-08-24:java_classes_not_extendable_by_javascript

Java classes NOT extendable by Javascript

It's really a trivial issue but I feel so disappointed with this so I note. Java classes are not extendable by Javascript since java6.

Details. I read some descriptions that java classes could be extended by Javascript (actually, it was the Rhino Javascript site). Reading this, I became excited since that gives me a lot of ease in adding some functionalities to existing image analysis modules. In addition, many things that Java would not allow easily could be done using function.apply() and function.call(). But after trying around several hours, nothing worked such as

 var extendedPlugin = new JavaAdoptor(pluginClass, {funciton1, function2, function3})
 

but then all the trials never worked out. Then I found in the following site:

Rhino standalone download supports extending a java class through JavaAdapter. But, the bundled JavaScript engine in JDK 6 does not support this. Supporting this requires .class file generation – which has been removed in JDK 6 (for security and footprint reasons). See also: JDK 6 release notes - scripting section.

http://asafmjavacorner.blogspot.com/2008/11/extending-java-class-in-javascript.html

sigh.

blogtng/2011-08-24/java_classes_not_extendable_by_javascript.txt · Last modified: 2020/11/26 09:11 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki