title: JPEGMetadata cannot be resolved to a type
body: <p>I am working on a program that is essentially going to be a <strong>EXIF data stamper</strong> for exclusively JPEG images.</p>
  
  <p>The GUI is going to consist of a search box a load button and a display box to display the EXIF data. But i am running into an issue with the reader:</p>
  
  <pre><code>public class MetaRead {
      public String readCustomData(byte[] imageData, String key) throws IOException{
          ImageReader imageReader = ImageIO.getImageReadersByFormatName("JPEG").next();
  
          imageReader.setInput(ImageIO.createImageInputStream(new ByteArrayInputStream(imageData)), true);
  
          // read metadata of first image
          IIOMetadata metadata = imageReader.getImageMetadata(0);
  
          //this cast helps getting the contents 
  
          JPEGMetadata JPEGmeta = (JPEGMetadata) metadata; 
          NodeList childNodes = JPEGmeta.getStandardTextNode().getChildNodes();
  
          for (int i = 0; i &lt; childNodes.getLength(); i++) {
              Node node = childNodes.item(i);
              String keyword = node.getAttributes().getNamedItem("keyword").getNodeValue();
              String value = node.getAttributes().getNamedItem("value").getNodeValue();
              if(key.equals(keyword)){
                  return value;
              }
          }
          return null;
      }
  }
  </code></pre>
  
  <p>I am getting an error at <code>{JPEGMetadata JPEGmeta = (JPEGMetadata metadata;}</code> <strong>"JPEGMetadata cannot be resolved to a type"</strong></p>
  
  <p>the original code was for a PNG so i replaced all PNG with JPEG with find/replace.</p>