I'm trying to call a java method inside JavaScript.
The core constructors or methods could be used whereas a user-defined method couldnt be.
This works --> "var temp = new Packages.java.lang.Long(10); document.writeln(temp);"
But the following doesnt work --> " var tmp = new Packages.myclasses.myconstructor(); "
where "myconstructor" is an own class inside package "myclasses"
Can anyone help me in setting the classpath correctly to the user-defined classes in this case.
Waiting eagerly for a reply,
regards
Summiboy
I'm not sure you can do it that way - the browser's Java plugin would probably be limited to only the core classes that ship with a particular VM - for security reasons.
Even if you managed to somehow alter this locally (I would guess you could inject your own classes into the system jar file of the JRE your browser's plugin references), I am fairly certain it would not work for other web users.
I imagine that you can't alter the classpath from within javascript, but who knows. Anyway if you require your user to have jvm enabled in the first place why not just develop an applet rather than use jscript?
Bookmarks