Search code examples
javasqleclipsejdbcjava-6

how do I use different version of java


I've installed both java 6 and 7 and using eclipse to write a simple jdbc application. I have both sqljdbc4.jar and sqljdbc.jar in the lib folder. I'm getting this message...

Dec 18, 2013 9:29:51 AM com.microsoft.sqlserver.jdbc.SQLServerConnection

SEVERE: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.

Exception in thread "main" java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.

at com.microsoft.sqlserver.jdbc.SQLServerConnection.<init>(SQLServerConnection.java:304)

at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1011)

at java.sql.DriverManager.getConnection(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at sqldriver.doConnection(sqldriver.java:27)

at sqldriver.main(sqldriver.java:12)

If I'm suppose to be using 1.6 how would I go about doing that?


Solution

  • I got it.
    I needed to change the Run/Debug Settings > Edit > Execution environment enter image description here

    And there I go.
    It's not a permanent fix but it will do for now.