Resource specification not allowed here for source level below 1.7
<p>I am trying to open an <code>OutputStream</code> resource in a try with resources block:</p>

<pre><code>try (OutputStream output = connection.getOutputStream()) {
    output.write(query.getBytes(charset));
}
</code></pre>

<p>However, I got a compilation error:</p>

<blockquote>
  <p>Resource specification not allowed here for source level below 1.7</p>
</blockquote>

<p>Is there an equivalent for 1.6 or do I have to convert my project to 1.7?</p>