// and then deleting the row that contains the cell.
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("dvEmpty.xls");
int dvRow = 0;
HSSFSheet sheet = wb.getSheetAt(0);
DVConstraint dc = DVConstraint.createNumericConstraint(VT.INTEGER, OP.EQUAL, "42", null);
HSSFDataValidation dv = new HSSFDataValidation(new CellRangeAddressList(dvRow, dvRow, 0, 0), dc);
dv.setEmptyCellAllowed(false);
dv.setErrorStyle(ES.STOP);
dv.setShowPromptBox(true);
dv.createErrorBox("Xxx", "Yyy");