G
G
Governor2021-11-17 21:00:15
Java
Governor, 2021-11-17 21:00:15

How to make an interface to a Java program?

Let's say I'm writing an engine that has some kind of business logic and data storage structure, similar to 1C.
If I want users to be able to add their own Java plugins to my engine, I will need to describe the API classes for them, but I didn’t understand where to start and how it works.

When I try to google, a solid web api pops up, and I need NOT a WEB interface.
Please tell me what to read on this topic.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2021-11-18
@oldd

Start by understanding microsoft DLLs, COMs, DCOMs, they were the first to go down this path.
Then read about loading java classes

O
Odissey Nemo, 2021-11-25
@odissey_nemo

Usually I start writing a big program, with new logic and in a calm environment (without the rage of managers and directors), by describing the abstract necessary functionality on the interfaces. And then I will implement it.
This is especially useful when you are not writing alone. In this case, you implement your own interfaces agreed with the team, calmly referring to unrealized ones that others implement, without slowing you down at the beginning.
In your case, you can (I know this only for JIdea) create and debug a really working class. And then, right-clicking on the name of this class and then from the pop-up menu "Refactor"->"Extract interface". And voila, if there are no bad dependencies, then the interface (in the sense of Java syntax and as a separate class file) is ready. It remains to correctly comment it out and, perhaps, implement some default methods, transferring them from the already written code. Or whatever else is required. But most importantly, the interface for working methods is already there.
And to implement the interface in the plug-in is a matter of technology. Loading a plugin and calling it as an instance of an interface class is also not difficult.

L
Leonid, 2021-11-25
@3des

AWT, Swing and JavaFX. I just still think that the present and future is the Web API, but if you want a GUI, then I think the most promising JavaFX, gnaw it).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question