views:

300

answers:

1

When using ANT to build my Java application I keep getting this error. I have tried multiple times to use SQLJDBC.JAR and SQLJDBC4.JAR but continually receive this error message. I am completely stumpped why this error is received even after upgrading to sqljdbc4.jar.

[javadoc] java.lang.UnsupportedOperationException: 
    Java Runtime Environment (JRE) version 1.6 is not supported by this driver.
    Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
+1  A: 

Refer to this link: http://msdn.microsoft.com/en-us/library/ms378526.aspx

"sqljdbc4.jar class library requires a Java Runtime Environment (JRE) of version 6.0 or later."

So if you aren't using a JDK 1.6 or later when compiling, you will get an error when using sqljdbc4.jar.

If you are using JDK 1.5 or earlier, then you need to be using the sqljdbc.jar, which you can get from here.

Also, one tip with ANT is that you can use "ant -verbose" to help determine which libaries it's finding on the classpath to make sure it's using the sqljdbc JAR you expect. Also, make sure to confirm which version of the JDK you are compiling with. You can set the JAVA_HOME environment variable to point to a different JDK to compile with.

dcp