antonio:
Do I need to create a plugin to access this, or is there another way?
AFAIK, you cannot directly access arbitrary Java methods from Servoy’s methods JavaScript code. You have to create a plugin that exposes the proper methods to Servoy and acts as a bridge between Servoy and your third party Java libraries.
I hope I’m not wrong '
As far as I remember (tried a while ago), you can call any Java method (if the class is reacheable) if you start your call with “java”. So in your case you could try
So far, so good. I also got this working (in developer): creating classes and calling methods from an external jar. For this I placed the external jar in the application_server\plugins directory and adressed the jar like Packages.net.sf.SomeClass.
But what do I have to do if I want to deploy this to an application server? Copying the jar is not enough, I get the error message “TypeError: SomeClass is not a function, it is org.mozilla.javascript.NativeJavaPackage.”
Already restarted application server and cleaned java cache.
That is correct Paul, smart client running with an application server in which our solution was imported. But keep in mind: it is not a plugin it is just an external jar from which we want to access a class in the following way
var _java_class = new Packages.org.myclasses.SomeClass()
and copied the myClasses.jar and myClasses.jar.jnlp to the plugins directory of the application server. Restart, cleaning catalina cache, cleaning client java cache did not have the effect that the jar was loaded to the client (checked it in the java cache).
The jnlp needs to match a plugin that implements the IClientPlugin interface and then you include your extra jar in the JNLP for that “plugin”.
Another option is adding the jar to your beans folder: the libraries that are located in the beans folder get automatically shipped to the Smart Client.
pbakker:
Another option is adding the jar to your beans folder: the libraries that are located in the beans folder get automatically shipped to the Smart Client.
Thanks for confirming this Paul.
Out of interest, what will happen with the WebClient?
pbakker:
adding the jar to your beans folder: the libraries that are located in the beans folder get automatically shipped to the Smart Client.
… yes, it works properly!!! But…
antonio:
what will happen with the WebClient?
In fact, from Developer it works right in both scenarios, but when launched against an external server (against a production server) the .jar is shipped if launched in Smart Client, but when launched with Web Client, it crash…
Exists some way to do this? I mean, using an external .jar (without making a Servoy bean) through Internet in Web Client?
pbakker:
How did you include the jar file in your Servoy installation? Throught the beans folder, or with a jnlp file in the plugins directory?
By now, I included it in beans folder (to get access in Developer)… I was wondering what happened if I included it with a jnlp… Do you think I’d must to include in plugin’s folder with a jnlp?