Programming using Java files

Hi everybody, :)

I would like to use Java code for my project. I have read the tutorial “Java for Servoy Developers” from Jeff Bader.
But I have a question: how do you re-use .java files that you had/have created? And how do you use “external” APIs which are not available by default with Java?
I assume if the API is a jar file you can include it in developer as a library, but what about folders and java files? Do we have to create a jar file with them in order to use them? :roll:

Thanks in advance. :wink:

Imho, so long as you work with standard Java files it is ‘easy’ to work with Java within Servoy.
When you are going to work with 3rd party libs you need to have them distributed to the client as well.

As soon as you add the libs to the plugins folder you will notice that you can use the methods that have your Java code included.
However, for a client it is different.
For that you would have to create a .jnlp file.
All .jnlp files in the plugins folder can serve as a sample.
When you want to know more about it you can search for it.

IT2Be:
Imho, so long as you work with standard Java files it is ‘easy’ to work with Java within Servoy.

How exactly? Can you give me an example with a file like “HelloWorld.java” which could contain a function which prints “Hello World!” for instance?

IT2Be:
When you are going to work with 3rd party libs you need to have them distributed to the client as well.

As soon as you add the libs to the plugins folder you will notice that you can use the methods that have your Java code included.
However, for a client it is different.
For that you would have to create a .jnlp file.
All .jnlp files in the plugins folder can serve as a sample.

Does it mean that when I use a jar file, I have to include it in the library of my project in developer AND also in plugins with its corresponding .jnlp (that I would have created). But just if the client needs to use a method from the library?

Does it mean that when I use a jar file, I have to include it in the library of my project in developer AND also in plugins with its corresponding .jnlp (that I would have created). But just if the client needs to use a method from the library?

Not in the library, only in the plugins folder.
When the client needs a method from the library the library has to be available in the client…

I’ve found a better solution to use Java files: making your own plugin!
It’s very easy actually :D

Thx for the help