Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2020-04

Integration of fpc/jvm classes in java prorgram

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

I have to integrate in an existing java product a custom functionality. This product has a plugin system where you implement some classes, (implementing predefined interfaces) and override the methods of the such classes/interfaces.

It also provides some api classes you can call back into and it uses java swing for the UI.

Would it be possible to use the fpc jvm to implement plugins for this system? (i.e. is it easy enough to implement derived classes and call into the java api)? Or I should better learn java (ouch)?

I know I've not been very specific, but I'm just starting to learn about this system.

Bye

Luca

Reply by email

Jonas Maebe
to Luca Olivetti
Luca Olivetti wrote 10 lines
I have to integrate in an existing java product a custom functionality. This product has a plugin system where you implement some classes, (implementing predefined interfaces) and override the methods of the such classes/interfaces. It also provides some api classes you can call back into and it uses java swing for the UI. Would it be possible to use the fpc jvm to implement plugins for this system?

Yes.

(i.e. is it easy enough to implement derived classes and call into the java api)?

Creating derived classes works the same as in Object Pascal: type
tmyclass = class(javaclass)
..

  end;

Calling the Java API is also easy, once you create an import unit. Explanations on how to do that can be found at
https://wiki.freepascal.org/FPC_JVM/Building#Creating_interfaces_for_other_Java_classes

The hard part is that while most high level language features are available, none of the standard units are (apart from part of the System unit). This means you will have to write Pascal code against the Java API for anything non-trivial.

See https://wiki.freepascal.org/FPC_JVM for more information.

Jonas

Reply by email

Luca Olivetti
to Jonas Maebe

El 18/4/20 a les 20:04, Jonas Maebe ha escrit:

Show quoted text 7 lines
The hard part is that while most high level language features are available, none of the standard units are (apart from part of the System unit). This means you will have to write Pascal code against the Java API for anything non-trivial. See https://wiki.freepascal.org/FPC_JVM for more information.

Thank you.

I think I'll try and use java directly: I followed the tutorials of this system and with eclipse it isn't too bad to write java code (though I instinctively don't like it).
The real problem is that I have do design the gui programmatically (2000 lines of code for a label and a slider, ouch), it seems I cannot even use WindowsBuilder. It threw me back 25 years, when I built user interfaces in clipper, and even clipper was less verbose ;-)

Bye

Luca

Reply by email