title: How to specify java class version for H2 Database User-Defined Functions and Stored Procedures?
body: <p>here: <a href="http://www.h2database.com/html/grammar.html#create_alias" rel="nofollow">create_alias</a> &amp; <a href="http://www.h2database.com/html/features.html#user_defined_functions" rel="nofollow">user_defined_functions</a> it is written:</p>
  
  <blockquote>
    <p>the Sun javac is compiler is used if the file tools.jar is in the
    classpath.  If not, javac is run as a separate process.</p>
  </blockquote>
  
  <p>How can one specify java class version for H2 Database User-Defined Functions and Stored Procedures - i.e. javac invocation options for the external javac? Can you always force external javac (even if jdk/tool.jar found)?</p>
  
  <p>for example, H2 is built against java 1.5; I am running on java 1.7:</p>
  
  <pre><code>org.apache.ibatis.exceptions.PersistenceException: 
  ### Error updating database.  Cause: org.h2.jdbc.JdbcSQLException: 
  General error: 
  "java.lang.UnsupportedClassVersionError: org/h2/dynamic/NEXT_PRIME : 
  Unsupported major.minor version 51.0"; SQL statement:
  CREATE ALIAS NEXT_PRIME AS $$
          String nextPrime(String value) {
              return new BigInteger(value).nextProbablePrime().toString();
          }
      $$; [50000-167]
      at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
      at org.h2.message.DbException.get(DbException.java:158)
      at org.h2.message.DbException.convert(DbException.java:277)
      at org.h2.command.Command.executeUpdate(Command.java:234)
      at org.h2.server.TcpServerThread.process(TcpServerThread.java:328)
      at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: java.lang.UnsupportedClassVersionError: org/h2/dynamic/NEXT_PRIME : 
  Unsupported major.minor version 51.0
  </code></pre>
  
  <p>thanks;</p>
  
  <p>Andrei.</p>