title: Netbeans "illegal start of type" error
body: <p>I am following the Netbeans CRUD Application tutorial (modified to use my own database) and I am getting this error that I can't figure out at all.</p>
  
  <p>The error says "illegal start of type ';' expected, cannot find symbol</p>
  
  <p>This is my code:</p>
  
  <pre><code>/*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package com.photo.viewer;
  
  import demo.Photos;
  import java.util.List;
  import javax.persistence.EntityManager;
  import javax.persistence.Persistence;
  import javax.persistence.Query;
  import org.netbeans.api.settings.ConvertAsProperties;
  import org.openide.awt.ActionID;
  import org.openide.awt.ActionReference;
  import org.openide.util.NbBundle.Messages;
  import org.openide.windows.TopComponent;
  
  /**
   * Top component which displays something.
   */
  @ConvertAsProperties(
          dtd = "-//com.photo.viewer//photoViewer//EN",
          autostore = false
  )
  @TopComponent.Description(
          preferredID = "photoViewerTopComponent",
          //iconBase="SET/PATH/TO/ICON/HERE", 
          persistenceType = TopComponent.PERSISTENCE_ALWAYS
  )
  @TopComponent.Registration(mode = "explorer", openAtStartup = true)
  @ActionID(category = "Window", id = "com.photo.viewer.photoViewerTopComponent")
  @ActionReference(path = "Menu/Window" /*, position = 333 */)
  @TopComponent.OpenActionRegistration(
          displayName = "#CTL_photoViewerAction",
          preferredID = "photoViewerTopComponent"
  )
  @Messages({
      "CTL_photoViewerAction=photoViewer",
      "CTL_photoViewerTopComponent=photoViewer Window",
      "HINT_photoViewerTopComponent=This is a photoViewer window"
  })
  public final class photoViewerTopComponent extends TopComponent {
  
      public photoViewerTopComponent() {
          initComponents();
          setName(Bundle.CTL_photoViewerTopComponent());
          setToolTipText(Bundle.HINT_photoViewerTopComponent());
  
      }
  
      /**
       * This method is called from within the constructor to initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is always
       * regenerated by the Form Editor.
       */
      // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;                          
      private void initComponents() {
  
          jScrollPane1 = new javax.swing.JScrollPane();
          jTextArea1 = new javax.swing.JTextArea();
  
          jTextArea1.setColumns(20);
          jTextArea1.setRows(5);
          jScrollPane1.setViewportView(jTextArea1);
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
          this.setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addGap(27, 27, 27)
                  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(129, Short.MAX_VALUE))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addGap(16, 16, 16)
                  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(200, Short.MAX_VALUE))
          );
      }// &lt;/editor-fold&gt;                        
  
      // Variables declaration - do not modify                     
      private javax.swing.JScrollPane jScrollPane1;
      private javax.swing.JTextArea jTextArea1;
      // End of variables declaration                   
      @Override
      public void componentOpened() {
          // TODO add custom code on component opening
      }
  
      @Override
      public void componentClosed() {
          // TODO add custom code on component closing
      }
  
      void writeProperties(java.util.Properties p) {
          // better to version settings since initial version as advocated at
          // http://wiki.apidesign.org/wiki/PropertyFiles
          p.setProperty("version", "1.0");
          // TODO store your settings
      }
  
      void readProperties(java.util.Properties p) {
          String version = p.getProperty("version");
          // TODO read your settings according to their version
      }
      EntityManager entityManager = Persistence.createEntityManagerFactory("catalogueLibraryPU").createEntityManager();
  Query query = entityManager.createNamedQuery("Photos.findAll");
  List&lt;Photos&gt; resultList = query.getResultList();
  for (Photos c : resultList) {
    jTextArea1.append(c.getTitle() + " (" + c.getLocation() + ")" + "\n");
  } 
  }
  </code></pre>
  
  <p>The error is in the 4th last line:</p>
  
  <pre><code>for (Photos c : resultList) {
        jTextArea1.append(c.getTitle() + " (" + c.getLocation() + ")" + "\n");
      } 
  </code></pre>
  
  <p>I know it is something simple but I cannot figure out what or how to fix it. I am sure it is a misplaced ';' or something?</p>
  
  <p>As you are no doubt aware I am new to Java.</p>
  
  <p>I have done everything the tutorial says but can't seem to figure this out...</p>
  
  <p>Any help would be grand!</p>
  
  <p>Thanks</p>