Support for Fill-in fields in Java

I’m attempting to do this in java and I’m unable to get any prompting after many tries.

Here is an example of my code:

String[] tokentest = new String[]{ "case", "case_status", "status_date" };
String[] datatest = new String[]{ "2002 CRIM 509", "Open", "01/01/2022" };		

doc.getFieldOptions().setUserPromptRespondent(new HandlePrompts());
doc.updateFields();
doc.getMailMerge().execute(tokentest, datatest);		

public class HandlePrompts implements IFieldUserPromptRespondent
{

	@Override
	public String respond(String promptText, String defaultResponse) {
		// TODO Auto-generated method stub
		return "";
	}
}

If I return no value I’m at least able to select Ctrl+A and F9 to get the prompt to trigger after the document opens but I thought the updateFields() command triggered this automatically.

I’ve attempted to use System.console() in java to attempt to get this prompting but it’s null so I can’t use that or I get a NPE.

    public class HandlePrompts implements IFieldUserPromptRespondent
    {

		@Override
		public String respond(String promptText, String defaultResponse) {
			// TODO Auto-generated method stub
			System.out.println("Console is: " + System.console());
			System.console().writer().write("Please enter value for FILLIN  field (" + promptText + "): ");
			return System.console().readLine();
		}
    }    
}

Is there any known way to prompt the user in java or do I need to build something inside of the respond method to handle this myself?

I have attached the template I am testing in case my set up is wrong. I have also included a screen print of the desired result and how it works when opening the document in word.

AsposeDocs.7z (335.2 KB)

@beaustanko Your code is correct. Most likely, the problem is that you are running your application form IDE in this case System.console() returns null - this means there is no console available. If you run your application from terminal, the code should work as expected. You can also use the workaround for System.console() suggested here.
Please see the following code:

String[] tokentest = new String[]{ "case", "case_status", "status_date" };
String[] datatest = new String[]{ "2002 CRIM 509", "Open", "01/01/2022" };

Document doc = new Document("C:\\Temp\\in.doc");
doc.getFieldOptions().setUserPromptRespondent(new HandlePrompts());
doc.getMailMerge().execute(tokentest, datatest);

doc.save("C:\\Temp\\out.docm");
public static class HandlePrompts implements IFieldUserPromptRespondent
{
    @Override
    public String respond(String promptText, String defaultResponse)  {
        try {
            return readLine("Please enter value for FILLIN  field (" + promptText + "): ");
        } catch (IOException e) {
            return "";
        }
    }

    private static String readLine(String format, Object... args) throws IOException {
        if (System.console() != null) {
            return System.console().readLine(format, args);
        }
        System.out.print(String.format(format, args));
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        return reader.readLine();
    }
}