private void loadTemplateFile() throws CompilationExecutionException {
    
        String text;
        BufferedReader rd=null;
        FileReader fr=null;
        
        String lf=System.getProperty("line.separator");
        
        String templateName;
        if (doGetCrossCompilingDirectory().endsWith(File.separator)) 
            templateName=doGetCrossCompilingDirectory()+doGetTemplateFileName(); 
        else templateName=doGetCrossCompilingDirectory()+File.separator+doGetTemplateFileName();  

        outputProgram=new StringBuilder();
        
        try {
            fr=new FileReader(templateName);
            rd=new BufferedReader(fr);
            while ( (text=rd.readLine()) != null) 
                outputProgram.append(text).append(lf);
        }
        catch(IOException e) {
            String err="I/O exception during template file opening: "+e.getMessage();
            ActionEvent ae1=new ActionEvent(this,ProgramCompiler.EVENTID_COMPILING_CONFIGURATIONERROR,err);
            ActionEvent ae2=new ActionEvent(this,ProgramCompiler.EVENTID_COMPILING_FAILED,null);
            throw new CompilationExecutionException(ae1,ae2);
        }
        finally {
            try { if (rd!=null) rd.close(); } catch(Exception ex) {}
            try { if (fr!=null) fr.close(); } catch(Exception ex) {}
        }
        
        int insertPointPos=outputProgram.indexOf(INSERTION_POINT_LABEL);
        if (insertPointPos==-1) {
            String err="The template file doesn't contain the insertion label: "+INSERTION_POINT_LABEL+", File:"+templateName;
            ActionEvent ae1=new ActionEvent(this,ProgramCompiler.EVENTID_COMPILING_CONFIGURATIONERROR,err);
            ActionEvent ae2=new ActionEvent(this,ProgramCompiler.EVENTID_COMPILING_FAILED,null);
            throw new CompilationExecutionException(ae1,ae2);
        }
    }