Thanks @Hans and @mkl for your inputs, on which I edited my question and hope it's not off-topic anymore, and I'll answer the question myself:
Using Apache PDFBox, you can fill a form text field with a known fully qualified name like this:
import org.apache.pdfbox.Loader;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDField;
import org.apache.pdfbox.pdmodel.PDDocument;
import java.io.File;
public class FillForm
{
public static void main(String[] args) throws IOException
{
String formTemplate = "emptyform.pdf";
PDDocument pdfDocument = Loader.loadPDF(new File(formTemplate));
PDAcroForm acroForm = pdfDocument.getDocumentCatalog().getAcroForm();
PDField text1 = acroForm.getField("Text1");
text1.setValue("A Text");
pdfDocument.save("filledform.pdf");
pdfDocument.close();
}
}