I personally use java creme around the terminal and javax.comm package for printing the file. I am unable to achieve towards the COM6 Virtual serial port the terminal ways to use printing around the java. How do i achieve towards the virtual serial port?

My code is below:

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Properties;
import javax.comm.CommPort;
import javax.comm.CommPortIdentifier;
public class Dene extends Frame 
{
  TextArea textArea;
  Label statusInfo;
  Button cleanButton, printButton, closeButton;
  Properties props = new Properties();
  public Dene() 
  {  
    super ("File Loader");
    setSize(java.awt.Toolkit.getDefaultToolkit().getScreenSize());
    add (statusInfo = new Label(), "North");
    Panel p = new Panel ();
    p.add (printButton = new Button ("Yazd─▒r"));
    printButton.addActionListener( new PrintCommand() );
    p.add (cleanButton = new Button ("Temizle"));
    cleanButton.addActionListener( new CleanCommand() );
    p.add (closeButton = new Button ("Kapat"));
    closeButton.addActionListener( new CloseCommand() );        
    add (p, "South");
    add (textArea = new TextArea (10, 40), "Center");
    Calendar calendar = Calendar.getInstance();
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    textArea.setText(dateFormat.format(calendar.getTime())+"\n");
    pack();
  }

  public static void main (String args[]) {
    Dene d = new Dene();
    d.show();
  }

  class CleanCommand implements ActionListener 
  {
        public void actionPerformed (ActionEvent e) {
            Calendar calendar = Calendar.getInstance();
            SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
            textArea.setText(dateFormat.format(calendar.getTime())+"\n");
        }
  }


  class CloseCommand implements ActionListener 
  {
        public void actionPerformed (ActionEvent e) {
          System.exit (0);
        }
  }

  // Print a file into the text area.
  class PrintCommand implements ActionListener 
  {
        public void actionPerformed (ActionEvent e) 
        {
            try
            {
                  StringReader sr = new StringReader (textArea.getText());
                  LineNumberReader lnr = new LineNumberReader (sr);
                  String nextLine;
                  FileWriter fstream = new FileWriter("My Documents/out.txt");
                  BufferedWriter out = new BufferedWriter(fstream);
                  do 
                  {
                        nextLine = lnr.readLine();
                        if (nextLine != null) 
                        {         
                            out.write(nextLine);
                            out.newLine();
                        }
                 } 
                 while (nextLine != null);
                 out.close();




                 String portname = "COM6:";
                 String filename = "My Documents/out.txt";
                 // Get port
                    FileWriter fstream2 = new FileWriter("My Documents/out2.txt");
                    BufferedWriter out2 = new BufferedWriter(fstream2); 
                    out2.write("burda....0");       
                    out2.close();                
                    CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(portname);
                    fstream2 = new FileWriter("My Documents/out2.txt");
                    out2 = new BufferedWriter(fstream2);    
                    out2.write("burda....1");       
                    out2.close();
                 // Open port
                 // Requires owner name and timeout
                 CommPort port = portId.open("Yazdir", 30000);
                    fstream2 = new FileWriter("My Documents/out2.txt");
                    out2 = new BufferedWriter(fstream2);    
                    out2.write("burda....2");       
                    out2.close();    
                 // Setup reading from file
                 FileInputStream fis = new FileInputStream(filename);


                 BufferedInputStream bis = new BufferedInputStream(fis);

                // Setup output
                OutputStream os = port.getOutputStream();

                BufferedOutputStream bos = new BufferedOutputStream(os);

                int c;
                while ((c = bis.read()) != -1) {
                   bos.write(c);
                }
                // Close

                bos.close();
                bis.close();
                port.close();
                fstream2 = new FileWriter("My Documents/out2.txt");
                out2 = new BufferedWriter(fstream2);    
                out2.write("burda3....");       
                out2.close();

            }
            catch(javax.comm.PortInUseException e1)
            {
                try
                {
                    FileWriter fstream2 = new FileWriter("My Documents/out2.txt");
                    BufferedWriter out2 = new BufferedWriter(fstream2); 
                    out2.write("hata: portinuser::::"+e1.getMessage());     
                    out2.close();   
                }
                catch(Exception eb)
                {
                    eb.printStackTrace();
                }       
            }               
            catch(javax.comm.NoSuchPortException e1)
            {
                try
                {
                    FileWriter fstream2 = new FileWriter("My Documents/out2.txt");
                    BufferedWriter out2 = new BufferedWriter(fstream2); 
                    out2.write("hata: nosuch port:::"+e1.getMessage());  
                    out2.newLine();
                    Enumeration ports = CommPortIdentifier.getPortIdentifiers();  
                    while(ports.hasMoreElements()){  
                        CommPortIdentifier port = (CommPortIdentifier) ports.nextElement();

                        out2.write(port.getName()+" type:"+port.getPortType());
                        out2.newLine();
                    }                   
                    out2.close();   
                }
                catch(Exception eb)
                {
                    eb.printStackTrace();
                }       
            }

            catch(IOException e1)
            {
                try
                {
                    FileWriter fstream2 = new FileWriter("My Documents/out2.txt");
                    BufferedWriter out2 = new BufferedWriter(fstream2); 
                    out2.write("hata: io::::::"+e1.getMessage());       
                    out2.close();   
                }
                catch(Exception eb)
                {
                    eb.printStackTrace();
                }       
            }           

        }
    }

}