How to call Java method from another class using @ClientCallable?

Vaadin code:

public class HelloWorldView extends VerticalLayout {
  private Button button = new Button();
public HelloWorldView() {
    button.addClickListener(event -> {
          .then(encodedCredential -> {
            // some code

I use the executeJs() function to call a Js function called registerWebAuthn2 in the testen_funktion.js.

Java code:

public class TestTool {
    public static void main(String[] args) throws IllegalArgumentException, NoSuchAlgorithmException {
        MFAClientTool client = new MFAClientTool("", "testuser",
        // the rest of the code

My question is how to use the method from the class TestTool inside the class HelloWorldView. I suppose I have to use the @ClientCallable annotation. Can you help me here?

Nobody can help me?

You are on the Java side. You can call your Java function. Maybe I didn’t understand what you’re trying to do

How would you do that?

If you just want to call the main method in your test tool class from the view it would be TestTool.main(new String[0])

Or something along those lines

I probably wouldn’t put that in a psvm method though as it suggests it’s an entry point into your program