A quick and simple way to output some text to a printer is to print to OS logical device attached a printer. For example, on a Windows machine : import java.io.*;
public class SimplePrinting {
public static void main(String[] args) {
try {
FileWriter out = new FileWriter("lpt1");
out.write("Hello world");
out.write(0x0c); // CR
out.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}