CommandLauncher launcher = new CommandLauncher("SpellChecker"); ByteArrayOutputStream errorStream = new ByteArrayOutputStream(); InputStream inputStream = new ByteArrayInputStream(text.getBytes("UTF-8")); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // XXXX TODO should use piping here, and perhaps even pooling launcher.execute(new String[]{"aspell", "-a", "-H", "--lang=nl", "--encoding=utf-8"}); launcher.waitAndWrite(inputStream, outputStream, errorStream); BufferedReader output = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(outputStream.toByteArray()), "UTF-8")); String line = output.readLine(); while (line != null) { if (line.startsWith("& ")) { int colon = line.indexOf(":"); int wordEnd = line.substring(2).indexOf(" "); line.substring(2, wordEnd + 2) line.substring(colon + 1) } line = output.readLine(); } new String(errorStream.toByteArray(), "UTF-8")