SerialTest class is provided. It initializes the serial port and then write data to it.

Java Code:
public class SerialTest {
 public static void main( String args[]) {
  Runtime rt = Runtime.getRuntime();
  Process p = null;
  String portname = "com1:";
  // for Win95 : c:\\windows\\command.com
  //             c:\\windows\\command\\mode.com   
  String cmd[] = {
   "c:\\winnt\\system32\\cmd.exe", "/c",
   "start", "/min",
   "c:\\winnt\\system32\\mode.com", portname,
   "baud=9600", "parity=n", "data=8",
   "stop=1", 
   };
  try {
   p = rt.exec( cmd );
   if( p.waitFor() != 0 ) {
    System.out.println("Error executing command: " + cmd );
    System.exit( -1 );
    }
   byte data[] = 
     "Hello World".getBytes();
   FileOutputStream fos = new FileOutputStream( portname );
   BufferedOutputStream bos = new BufferedOutputStream( fos );
   fos.write( data, 0, data.length );
   fos.close();
   }
  catch( Exception e ) {
   e.printStackTrace();
   }
 }
}